Fixed a crash.

The editor wasn't checking if the last opened file actually existed, so when it didn't exist, it crashed every time.
This commit is contained in:
The Wobbler 2024-11-30 22:03:42 +01:00
parent 047fcbe856
commit 917d59a139

View file

@ -1,8 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os
import sys import sys
from pathlib import Path from pathlib import Path
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QMessageBox from PyQt6.QtWidgets import QMessageBox
from file import File from file import File
@ -110,5 +110,6 @@ class Utils:
if len(sys.argv) == 1: # if no parameters were passed to the editor if len(sys.argv) == 1: # if no parameters were passed to the editor
file_path = self.app.settings.last_opened_file file_path = self.app.settings.last_opened_file
if os.path.isfile(file_path):
file = File(self.app, file_path, file_path.split("/")[-1]) file = File(self.app, file_path, file_path.split("/")[-1])
self.app.open_files[file_path] = file self.app.open_files[file_path] = file