From 7f1be62734b06bfb12fd48023821f50ee8757eb8 Mon Sep 17 00:00:00 2001 From: daniel Date: Sat, 12 Oct 2024 19:22:19 +0200 Subject: [PATCH] fix(scripting/mono-v2): validate app domain before removing ref --- .../citizen-scripting-mono-v2/src/MonoScriptRuntime.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/components/citizen-scripting-mono-v2/src/MonoScriptRuntime.cpp b/code/components/citizen-scripting-mono-v2/src/MonoScriptRuntime.cpp index fee3b816fa..5c61356f32 100644 --- a/code/components/citizen-scripting-mono-v2/src/MonoScriptRuntime.cpp +++ b/code/components/citizen-scripting-mono-v2/src/MonoScriptRuntime.cpp @@ -379,6 +379,12 @@ result_t MonoScriptRuntime::RemoveRef(int32_t refIndex) { fx::PushEnvironment env(this); MonoComponentHost::EnsureThreadAttached(); + + if (m_appDomain == nullptr) + { + return FX_E_INVALIDARG; + } + MonoDomainScope scope(m_appDomain); MonoException* exc = nullptr;