From 8dd47e51d9c318e522b21f28bc3e3935ef692056 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 4 Jul 2013 21:11:28 +0300 Subject: add missing checks. also fix crash in creating character with broken data. --- src/resources/beinginfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/resources/beinginfo.cpp') 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 -- cgit v1.2.3-60-g2f50