summaryrefslogtreecommitdiff
path: root/src/actions/chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/chat.cpp')
-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;
}