Fix possible crash at NativeScript::get_base_script
(cherry picked from commit 77f3c0b495
)
This commit is contained in:
parent
754514df7e
commit
5c69f83c96
|
@ -150,7 +150,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