瀏覽代碼

Fix crash when closing a TextFile

(cherry picked from commit 54bca425b2443cc8e3fd7299cd8108bcad1729b4)
Paulb23 5 年之前
父節點
當前提交
ca4fe82a7f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      editor/plugins/script_editor_plugin.cpp

+ 1 - 1
editor/plugins/script_editor_plugin.cpp

@@ -585,7 +585,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
 		Ref<Script> script = current->get_edited_resource();
 		if (p_save) {
 			// Do not try to save internal scripts
-			if (!(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) {
+			if (!script.is_valid() || !(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) {
 				_menu_option(FILE_SAVE);
 			}
 		}