Fix crash when gd-script _init fail

This commit is contained in:
sanikoyes 2014-12-18 12:50:47 +08:00
parent bed3b7f092
commit 4ccdbde845

View file

@ -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
}