From 7c01ddf996f4b8ca6d7e71c001e7650b3bf14609 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 21 Jul 2021 08:36:16 +0200 Subject: [PATCH] #6730 - GCodeViewer -> Fixed crash when importing gcode files generated by PrusaSlicer and edited by user or 3rd part post processors by appending new lines after the config section. Show instead the same error dialog as when trying to import the config into PrusaSlicer from the same gcode file --- src/slic3r/GUI/Plater.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9f70372720..d32d9a7e5b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4898,7 +4898,15 @@ void Plater::load_gcode(const wxString& filename) // process gcode GCodeProcessor processor; processor.enable_producers(true); - processor.process_file(filename.ToUTF8().data(), false); + try + { + processor.process_file(filename.ToUTF8().data(), false); + } + catch (const std::exception& ex) + { + show_error(this, ex.what()); + return; + } p->gcode_result = std::move(processor.extract_result()); // show results