summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-16 14:28:45 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-16 14:28:45 +0200
commit59dc0bffc0f754de8daed29bce3a48e90ea6b4fb (patch)
tree7cd423679a60e25b29318d7a87f367729f8d5fdf /src/resources/iteminfo.cpp
parentfbf665912933d10d9132b17802949149d9094fdd (diff)
downloadManaVerse-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.gz
ManaVerse-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.bz2
ManaVerse-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.tar.xz
ManaVerse-59dc0bffc0f754de8daed29bce3a48e90ea6b4fb.zip
Add checks and fix some code style.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 667037c58..70f183d0e 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -66,7 +66,9 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const
i = mSounds.find(event);
- return i == mSounds.end() ? empty : i->second[rand() % i->second.size()];
+ if (i == mSounds.end())
+ return empty;
+ return i->second.size() > 0 ? i->second[rand() % i->second.size()] : empty;
}
std::map<int, int> &ItemInfo::addReplaceSprite(int sprite)