mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-20 09:41:29 +00:00
Handle GetItemCount on references without a container store gracefully
This commit is contained in:
parent
11c21c28bf
commit
63e1b0ee9d
1 changed files with 7 additions and 1 deletions
|
@ -189,11 +189,17 @@ namespace MWScript
|
||||||
public:
|
public:
|
||||||
void execute(Interpreter::Runtime& runtime) override
|
void execute(Interpreter::Runtime& runtime) override
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime, false);
|
||||||
|
|
||||||
ESM::RefId item = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
ESM::RefId item = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
if (ptr.isEmpty() || (ptr.getType() != ESM::Container::sRecordId && !ptr.getClass().isActor()))
|
||||||
|
{
|
||||||
|
runtime.push(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item == "gold_005" || item == "gold_010" || item == "gold_025" || item == "gold_100")
|
if (item == "gold_005" || item == "gold_010" || item == "gold_025" || item == "gold_100")
|
||||||
item = MWWorld::ContainerStore::sGoldId;
|
item = MWWorld::ContainerStore::sGoldId;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue