fix QuickKeysMenu crash on reopening window after item drop + pickup [see: !11#note_85086570]

pull/456/head
Finbar Crago 7 years ago
parent 7ae388086b
commit 2722ca50fb

@ -99,15 +99,16 @@ namespace MWGui
{
MWWorld::Ptr item = *mKey[i].button->getUserData<MWWorld::Ptr>();
// Make sure the item is available and is not broken
if (item.getRefData().getCount() < 1 ||
if (!item || item.getRefData().getCount() < 1 ||
(item.getClass().hasItemHealth(item) &&
item.getClass().getItemHealth(item) <= 0))
{
// Try searching for a compatible replacement
std::string id = item.getCellRef().getRefId();
item = store.findReplacement(mKey[i].id);
if (item)
mKey[i].button->setUserData(MWWorld::Ptr(item));
item = store.findReplacement(id);
mKey[i].button->setUserData(MWWorld::Ptr(item));
break;
}
}

Loading…
Cancel
Save