From 77feb95191317a6e7bf077127a6a4d3293f67955 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 29 May 2018 11:05:55 +0200 Subject: [PATCH] Don't crash when failing to reload file Now it shows a message that it failed to load the file. --- cura/CuraApplication.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 5db616ab3b..ed4336a9a0 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1500,11 +1500,15 @@ class CuraApplication(QtApplication): def _reloadMeshFinished(self, job): # TODO; This needs to be fixed properly. We now make the assumption that we only load a single mesh! - mesh_data = job.getResult()[0].getMeshData() - if mesh_data: - job._node.setMeshData(mesh_data) - else: + job_result = job.getResult() + if len(job_result) == 0: + Logger.log("e", "Reloading the mesh failed.") + return + mesh_data = job_result[0].getMeshData() + if not mesh_data: Logger.log("w", "Could not find a mesh in reloaded node.") + return + job._node.setMeshData(mesh_data) def _openFile(self, filename): self.readLocalFile(QUrl.fromLocalFile(filename))