forked from teamnwah/openmw-tes3coop
fix QuickKeysMenu crash on reopening window after item drop + pickup [see: !11#note_85086570]
This commit is contained in:
parent
7ae388086b
commit
2722ca50fb
1 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
|
||||
item = store.findReplacement(id);
|
||||
if (item)
|
||||
mKey[i].button->setUserData(MWWorld::Ptr(item));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue