From 675b9f793e5b36862294e4f0419c5cf2eab72164 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Oct 2017 19:00:20 +0300 Subject: Fix some asserts in text command editor. --- src/textcommand.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/textcommand.cpp') 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)); -- cgit v1.2.3-60-g2f50