summaryrefslogtreecommitdiff
path: root/src/resources/beinginfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-04 21:11:28 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-04 21:11:28 +0300
commit8dd47e51d9c318e522b21f28bc3e3935ef692056 (patch)
tree30b364f3f1b04fd31efec47332d193567894997f /src/resources/beinginfo.cpp
parentd1d205fbe0c2d63bbd08742c56f00852ccc0523b (diff)
downloadManaVerse-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.gz
ManaVerse-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.bz2
ManaVerse-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.xz
ManaVerse-8dd47e51d9c318e522b21f28bc3e3935ef692056.zip
add missing checks.
also fix crash in creating character with broken data.
Diffstat (limited to 'src/resources/beinginfo.cpp')
-rw-r--r--src/resources/beinginfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 361dead4d..f54673447 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -114,8 +114,8 @@ const SoundInfo &BeingInfo::getSound(const SoundEvent event) const
static SoundInfo emptySound("", 0);
const SoundEvents::const_iterator i = mSounds.find(event);
- return (i == mSounds.end() || !i->second) ? emptySound :
- i->second->at(rand() % i->second->size());
+ return (i == mSounds.end() || !i->second || i->second->empty())
+ ? emptySound : i->second->at(rand() % i->second->size());
}
const Attack *BeingInfo::getAttack(const int id) const