Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fix

fix: dict2inst crash when constructor has arguments
This commit is contained in:
Rémi Verschelde 2020-05-09 22:00:04 +02:00 committed by GitHub
commit b61a496aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1199,6 +1199,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, 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();