summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-09-10 23:11:54 +0200
committerGitHub <noreply@github.com>2018-09-10 23:11:54 +0200
commitc440bf82d64017270b86bcd9060e80a4beb3e4f9 (patch)
treef98d31192a354d7ec1493454b7a83990d56ac241
parentfe4c893c887c099bea851b8bd86c884ce0a29268 (diff)
parent0faafa6f4d80cf0b89cd60d925d9165fb148bc91 (diff)
Merge pull request #21941 from akien-mga/gdscript-memdelete-missing-script
Fix crash when extending non-existing GDScript file
-rw-r--r--modules/gdscript/gdscript.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 33d9c011f2..cf4fe29c86 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -2112,23 +2112,14 @@ RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_ori
script->set_script_path(p_original_path); // script needs this.
script->set_path(p_original_path);
Error err = script->load_byte_code(p_path);
-
- if (err != OK) {
- memdelete(script);
- ERR_FAIL_COND_V(err != OK, RES());
- }
+ ERR_FAIL_COND_V(err != OK, RES());
} else {
Error err = script->load_source_code(p_path);
-
- if (err != OK) {
- memdelete(script);
- ERR_FAIL_COND_V(err != OK, RES());
- }
+ ERR_FAIL_COND_V(err != OK, RES());
script->set_script_path(p_original_path); // script needs this.
script->set_path(p_original_path);
- //script->set_name(p_path.get_file());
script->reload();
}