From 917d59a139650585333ba0a5bd3e1a9483c461a3 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Sat, 30 Nov 2024 22:03:42 +0100 Subject: [PATCH] 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. --- utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.py b/utils.py index 16585d2..ec78e85 100644 --- a/utils.py +++ b/utils.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 +import os import sys from pathlib import Path -from PyQt6.QtCore import Qt from PyQt6.QtWidgets import QMessageBox from file import File @@ -110,5 +110,6 @@ class Utils: if len(sys.argv) == 1: # if no parameters were passed to the editor file_path = self.app.settings.last_opened_file - file = File(self.app, file_path, file_path.split("/")[-1]) - self.app.open_files[file_path] = file + if os.path.isfile(file_path): + file = File(self.app, file_path, file_path.split("/")[-1]) + self.app.open_files[file_path] = file