From feeab8a335f02415c6d621dc19809b3ccc9d0c98 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Fri, 10 Apr 2020 22:19:06 +0300 Subject: [PATCH] Make adding non-existent global script more forgiving (bug #5364) --- CHANGELOG.md | 1 + apps/openmw/mwscript/globalscripts.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31a5271db0..fc07444d48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ 0.47.0 ------ + Bug #5364: Script fails/stops if trying to startscript an unknown script 0.46.0 ------ diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index 63b0236c88..786cce072b 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -28,7 +28,7 @@ namespace MWScript if (iter==mScripts.end()) { - if (const ESM::Script *script = mStore.get().find (name)) + if (const ESM::Script *script = mStore.get().search(name)) { GlobalScriptDesc desc; desc.mRunning = true; @@ -37,6 +37,10 @@ namespace MWScript mScripts.insert (std::make_pair (name, desc)); } + else + { + Log(Debug::Error) << "Failed to add global script " << name << ": script record not found"; + } } else if (!iter->second.mRunning) {