Fix possible crash at NativeScript::get_base_script
This commit is contained in:
parent
4b549faaab
commit
77f3c0b495
|
@ -149,7 +149,10 @@ Ref<Script> NativeScript::get_base_script() const {
|
||||||
if (!script_data)
|
if (!script_data)
|
||||||
return Ref<Script>();
|
return Ref<Script>();
|
||||||
|
|
||||||
Ref<NativeScript> ns = Ref<NativeScript>(NSL->create_script());
|
NativeScript *script = (NativeScript *)NSL->create_script();
|
||||||
|
Ref<NativeScript> ns = Ref<NativeScript>(script);
|
||||||
|
ERR_FAIL_COND_V(!ns.is_valid(), Ref<Script>());
|
||||||
|
|
||||||
ns->set_class_name(script_data->base);
|
ns->set_class_name(script_data->base);
|
||||||
ns->set_library(get_library());
|
ns->set_library(get_library());
|
||||||
return ns;
|
return ns;
|
||||||
|
|
Loading…
Reference in New Issue