summaryrefslogtreecommitdiff
path: root/src/textcommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/textcommand.cpp')
-rw-r--r--src/textcommand.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/textcommand.cpp b/src/textcommand.cpp
index 8a5949613..320e295a2 100644
--- a/src/textcommand.cpp
+++ b/src/textcommand.cpp
@@ -125,10 +125,14 @@ void TextCommand::loadImage()
mImage = nullptr;
}
- if (getIcon().empty())
+ if (mIcon.empty() ||
+ !ItemDB::exists(mIcon))
+ {
return;
+ }
- const SpriteDisplay display = ItemDB::get(getIcon()).getDisplay();
+ const ItemInfo &info = ItemDB::get(mIcon);
+ const SpriteDisplay display = info.getDisplay();
mImage = Loader::getImage(pathJoin(paths.getStringValue("itemIcons"),
display.image));