mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
Fix potential crash.
This commit is contained in:
parent
7f03c8b429
commit
a349dbd762
@ -271,11 +271,15 @@ TextEditorVanillaEditor *TextFileEditor::open_in_vanillaeditor(const String &pat
|
|||||||
FileAccess *current_file = FileAccess::open(path, FileAccess::READ);
|
FileAccess *current_file = FileAccess::open(path, FileAccess::READ);
|
||||||
|
|
||||||
String current_content = "";
|
String current_content = "";
|
||||||
|
OS::DateTime last_modified;
|
||||||
|
|
||||||
|
if (current_file) {
|
||||||
current_content = current_file->get_as_utf8_string();
|
current_content = current_file->get_as_utf8_string();
|
||||||
OS::DateTime last_modified = OS::get_singleton()->get_datetime_from_unix_time(current_file->get_modified_time(path));
|
last_modified = OS::get_singleton()->get_datetime_from_unix_time(current_file->get_modified_time(path));
|
||||||
|
|
||||||
current_file->close();
|
current_file->close();
|
||||||
memdelete(current_file);
|
memdelete(current_file);
|
||||||
|
}
|
||||||
|
|
||||||
editor->new_file_open(current_content, last_modified, current_file_path);
|
editor->new_file_open(current_content, last_modified, current_file_path);
|
||||||
update_list();
|
update_list();
|
||||||
|
Loading…
Reference in New Issue
Block a user