summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-17 01:20:57 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-17 01:20:57 +0300
commit8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89 (patch)
tree3cce82508aadd3d69b503eeb29ff3b2d09910aad
parent5d77b00cba5398482c4eb9422ae4f06ae3509b8f (diff)
downloadplus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.gz
plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.bz2
plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.xz
plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.zip
Fix /hat command output if no hat equipped.
-rw-r--r--src/actions/chat.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index f8cb0731d..5a328b3b5 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -607,10 +607,18 @@ impHandler(hat)
const int sprite = localPlayer->getSpriteID(
charServerHandler->hatSprite());
- const ItemInfo &info = ItemDB::get(sprite);
- // TRANSLATORS: equipped hat chat message
- const std::string str = strprintf(_("equipped hat %s."),
- info.getName().c_str());
+ std::string str;
+ if (sprite == 0)
+ {
+ str = strprintf(_("no hat equipped."));
+ }
+ else
+ {
+ const ItemInfo &info = ItemDB::get(sprite);
+ // TRANSLATORS: equipped hat chat message
+ str = strprintf(_("equipped hat %s."),
+ info.getName().c_str());
+ }
outString(event.tab, str, str);
return true;
}