Use default icon.tga when inventory icon is missing

pull/593/head
AnyOldName3 4 years ago
parent 4b7d00530d
commit da6223fc4b

@ -6,6 +6,9 @@
#include <MyGUI_TextBox.h>
// correctIconPath
#include <components/resource/resourcesystem.hpp>
#include <components/vfs/manager.hpp>
#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);
}

Loading…
Cancel
Save