diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-04 21:11:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-04 21:11:28 +0300 |
commit | 8dd47e51d9c318e522b21f28bc3e3935ef692056 (patch) | |
tree | 30b364f3f1b04fd31efec47332d193567894997f /src/resources/beinginfo.cpp | |
parent | d1d205fbe0c2d63bbd08742c56f00852ccc0523b (diff) | |
download | mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.gz mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.bz2 mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.xz mv-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.cpp | 4 |
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 |