diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-17 01:20:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-17 01:20:57 +0300 |
commit | 8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89 (patch) | |
tree | 3cce82508aadd3d69b503eeb29ff3b2d09910aad /src | |
parent | 5d77b00cba5398482c4eb9422ae4f06ae3509b8f (diff) | |
download | plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.gz plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.bz2 plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.tar.xz plus-8becb9cbbdbeb4a3a9c6e2274c71ac6d04514a89.zip |
Fix /hat command output if no hat equipped.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/chat.cpp | 16 |
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; } |