From c3dfd6bd0c1bd834d60d52a4205392c49c7f92ef Mon Sep 17 00:00:00 2001 From: Edo Date: Sun, 14 May 2023 13:24:55 +0100 Subject: [PATCH] [ScriptExtension]: Do not lookup null pointers (#1037) --- src/Components/Modules/GSC/ScriptExtension.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/GSC/ScriptExtension.cpp b/src/Components/Modules/GSC/ScriptExtension.cpp index f5497679..e68220ae 100644 --- a/src/Components/Modules/GSC/ScriptExtension.cpp +++ b/src/Components/Modules/GSC/ScriptExtension.cpp @@ -28,9 +28,15 @@ namespace Components::GSC void ScriptExtension::GetReplacedPos(const char* pos) { - if (ReplacedFunctions.contains(pos)) + if (!pos) { - ReplacedPos = ReplacedFunctions[pos]; + // This seems to happen often and there should not be pointers to NULL in our map + return; + } + + if (const auto itr = ReplacedFunctions.find(pos); itr != ReplacedFunctions.end()) + { + ReplacedPos = itr->second; } }