From 9f6b20936e504b7d2cdb0a6fe9d7b3c33dd4ea86 Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Thu, 30 Apr 2020 17:35:53 +0530 Subject: [PATCH] fix: dict2inst crash when constructor has arguments --- modules/gdscript/gdscript_functions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 58161d6f532..2f98e600814 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1200,6 +1200,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = gdscr->_new(nullptr, 0, r_error); + if (r_error.error != Callable::CallError::CALL_OK) { + r_ret = Variant(); + return; + } + GDScriptInstance *ins = static_cast(static_cast(r_ret)->get_script_instance()); Ref gd_ref = ins->get_script();