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;