summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-02-07 01:02:38 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-02-09 18:21:53 +0100
commitfef443359c5b7ebbd1e417c7d0ae1895a86ff599 (patch)
treeaa95a1b19cd76ff7d21c41b3b3a5dddbc0c6c18c
parentaba7d57bfba218188b706e400390ca710431712b (diff)
downloadmana-client-fef443359c5b7ebbd1e417c7d0ae1895a86ff599.tar.gz
mana-client-fef443359c5b7ebbd1e417c7d0ae1895a86ff599.tar.bz2
mana-client-fef443359c5b7ebbd1e417c7d0ae1895a86ff599.tar.xz
mana-client-fef443359c5b7ebbd1e417c7d0ae1895a86ff599.zip
Avoid a crash after selecting one's character linked to emotes.
This happened when the emote shortcut config has got too high ids in it, i.e. when testing different client version on the same host. Reviewed-by: Erik Schilling
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 73cdd27c..1230e47a 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -96,10 +96,10 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
graphics->setColor(Theme::getThemeColor(Theme::TEXT));
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
- if (emoteShortcut->getEmote(i))
+ int emoteId = emoteShortcut->getEmote(i);
+ if (emoteId > 0 && emoteId <= EmoteDB::getLast())
{
- mEmoteImg[emoteShortcut->getEmote(i) - 1]->draw(g, emoteX + 2,
- emoteY + 10);
+ mEmoteImg[emoteId - 1]->draw(g, emoteX + 2, emoteY + 10);
}
}