Bläddra i källkod

Fix crash when gd-script _init fail

sanikoyes 10 år sedan
förälder
incheckning
4ccdbde845
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      modules/gdscript/gd_script.cpp

+ 1 - 1
modules/gdscript/gd_script.cpp

@@ -1440,8 +1440,8 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj
 
 	if (err.error!=Variant::CallError::CALL_OK) {
 		instance->script=Ref<GDScript>();
+		instance->owner->set_script_instance(NULL);
 		instances.erase(p_owner);
-		memdelete(instance);
 		ERR_FAIL_COND_V(err.error!=Variant::CallError::CALL_OK, NULL); //error consrtucting
 	}