From da6223fc4b7f5bb98143b6a5bd1585ce93fd9a92 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sun, 7 Feb 2021 23:27:45 +0000 Subject: [PATCH] Use default icon.tga when inventory icon is missing --- apps/openmw/mwgui/itemwidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/itemwidget.cpp b/apps/openmw/mwgui/itemwidget.cpp index 940e95a7e..7c7fa8828 100644 --- a/apps/openmw/mwgui/itemwidget.cpp +++ b/apps/openmw/mwgui/itemwidget.cpp @@ -6,6 +6,9 @@ #include // correctIconPath +#include +#include + #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -106,7 +109,10 @@ namespace MWGui std::string invIcon = ptr.getClass().getInventoryIcon(ptr); if (invIcon.empty()) invIcon = "default icon.tga"; - setIcon(MWBase::Environment::get().getWindowManager()->correctIconPath(invIcon)); + invIcon = MWBase::Environment::get().getWindowManager()->correctIconPath(invIcon); + if (!MWBase::Environment::get().getResourceSystem()->getVFS()->exists(invIcon)) + invIcon = MWBase::Environment::get().getWindowManager()->correctIconPath("default icon.tga"); + setIcon(invIcon); }