[ScriptExtension]: Do not lookup null pointers (#1037)

This commit is contained in:
Edo 2023-05-14 13:24:55 +01:00 committed by GitHub
parent 038680bd09
commit c3dfd6bd0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,15 @@ namespace Components::GSC
void ScriptExtension::GetReplacedPos(const char* pos) 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;
} }
} }