diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index d235192817..7f749185c6 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -299,6 +299,9 @@ namespace MWScript std::string id = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); + // make sure a spell with this ID actually exists. + MWBase::Environment::get().getWorld()->getStore().spells.find (id); + MWWorld::Class::get (ptr).getCreatureStats (ptr).mSpells.add (id); } };