fix: do not resume if file can't be opened

This commit is contained in:
xananax prozaxx 2023-03-10 00:11:34 +04:00
parent c3f8d02e61
commit bf3a9a35ce
2 changed files with 3 additions and 1 deletions

View File

@ -43,6 +43,7 @@ func start_entry(entry_name: String) -> void:
var file := FileAccess.open(source_path, FileAccess.READ_WRITE) var file := FileAccess.open(source_path, FileAccess.READ_WRITE)
if file == null: if file == null:
printerr("Could not open file") printerr("Could not open file")
return
entries.append(current_entry) entries.append(current_entry)
file.store_csv_line(current_entry.to_csv_line()) file.store_csv_line(current_entry.to_csv_line())
@ -69,6 +70,7 @@ func save() -> void:
var file := FileAccess.open(source_path, FileAccess.WRITE) var file := FileAccess.open(source_path, FileAccess.WRITE)
if file == null: if file == null:
printerr("Could not open file") printerr("Could not open file")
return
for time_entry in entries: for time_entry in entries:
file.store_csv_line(time_entry.to_csv_line()) file.store_csv_line(time_entry.to_csv_line())