summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
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)