From 712c7e80aaa2e6aedf35fe599b523cc46595e1e0 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 9f703727203..d32d9a7e5bd 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