mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 03:46:50 +01:00
Check parameter validity in Object::set_script
Fixes #46120. (cherry picked from commit 9c6c2f09e07e65f7819920c4954a7fd54b37d3f6)
This commit is contained in:
parent
8f03370bfa
commit
341f89b10c
@ -1005,14 +1005,16 @@ void Object::set_script(const RefPtr &p_script) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<Script> s = p_script;
|
||||
ERR_FAIL_COND_MSG(s.is_null() && !p_script.is_null(), "Invalid parameter, it should be a reference to a valid script (or null).");
|
||||
|
||||
script = p_script;
|
||||
|
||||
if (script_instance) {
|
||||
memdelete(script_instance);
|
||||
script_instance = nullptr;
|
||||
}
|
||||
|
||||
script = p_script;
|
||||
Ref<Script> s(script);
|
||||
|
||||
if (!s.is_null()) {
|
||||
if (s->can_instance()) {
|
||||
OBJ_DEBUG_LOCK
|
||||
|
Loading…
Reference in New Issue
Block a user