From fef443359c5b7ebbd1e417c7d0ae1895a86ff599 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Tue, 7 Feb 2012 01:02:38 +0100 Subject: 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 --- src/gui/widgets/emoteshortcutcontainer.cpp | 6 +++--- 1 file 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); } } -- cgit v1.2.3-70-g09d2