diff options
author | Thakee Nathees <thakeenathees@gmail.com> | 2020-04-30 17:35:53 +0530 |
---|---|---|
committer | Thakee Nathees <thakeenathees@gmail.com> | 2020-04-30 17:35:53 +0530 |
commit | 9f6b20936e504b7d2cdb0a6fe9d7b3c33dd4ea86 (patch) | |
tree | 2e6ff8fe391ebbb5341c67ed60e5afc5edb0fbb9 /modules/gdscript/gdscript_functions.cpp | |
parent | 92d4a0cbd231508221b0e977ae9a0e9d4207e328 (diff) |
fix: dict2inst crash when constructor has arguments
Diffstat (limited to 'modules/gdscript/gdscript_functions.cpp')
-rw-r--r-- | modules/gdscript/gdscript_functions.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 58161d6f53..2f98e60081 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<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance()); Ref<GDScript> gd_ref = ins->get_script(); |