From 27c0ca4dea6205f8360c4e2253c0c1adb8755473 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 Jan 2018 10:39:08 +0100 Subject: [PATCH] Move some things outside of try-catch clause Only the pre-read should really be in there. Otherwise we'd hide some mistakes in our code. Contributes to issue CURA-4810. --- cura/CuraApplication.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 099c71c708..402917d748 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1518,12 +1518,11 @@ class CuraApplication(QtApplication): """ Checks if the given file URL is a valid project file. """ + file_path = QUrl(file_url).toLocalFile() + workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path) + if workspace_reader is None: + return False # non-project files won't get a reader try: - file_path = QUrl(file_url).toLocalFile() - workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path) - if workspace_reader is None: - return False # non-project files won't get a reader - result = workspace_reader.preRead(file_path, show_dialog=False) return result == WorkspaceReader.PreReadResult.accepted except Exception as e: