From 97d8cc0efe4df7d618d31b666e3d97d555ffa9be Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 25 Jun 2018 11:21:00 +0400 Subject: [PATCH] Check if the local was not found, just for sure --- apps/openmw/mwscript/locals.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/locals.cpp b/apps/openmw/mwscript/locals.cpp index 9dd9d338e..64f3058eb 100644 --- a/apps/openmw/mwscript/locals.cpp +++ b/apps/openmw/mwscript/locals.cpp @@ -240,6 +240,10 @@ namespace MWScript char type = declarations.getType (iter->first); int index2 = declarations.getIndex (iter->first); + // silently ignore locals that don't exist anymore + if (type == ' ' || index2 == -1) + continue; + try { switch (type) @@ -247,8 +251,6 @@ namespace MWScript case 's': mShorts.at (index2) = iter->second.getInteger(); break; case 'l': mLongs.at (index2) = iter->second.getInteger(); break; case 'f': mFloats.at (index2) = iter->second.getFloat(); break; - - // silently ignore locals that don't exist anymore } } catch (...)