From f2c06d7059ac5555c9068c2d4187704f25a85735 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Thu, 6 Apr 2023 14:48:35 +0800 Subject: [PATCH] ENH: add some protective code JRIA: STUDIO-2487 Change-Id: I9b6e3e6af70877b685d2bfec1592975ef16134fd Signed-off-by: Stone Li --- src/slic3r/GUI/GCodeViewer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index d375297228..d749561d71 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1790,7 +1790,10 @@ void GCodeViewer::update_layers_slider_mode() void GCodeViewer::update_marker_curr_move() { if ((int)m_last_result_id != -1) { auto it = std::find_if(m_gcode_result->moves.begin(), m_gcode_result->moves.end(), [this](auto move) { - return move.gcode_id == static_cast(m_sequential_view.gcode_ids[m_sequential_view.current.last]); + if (m_sequential_view.current.last < m_sequential_view.gcode_ids.size() && m_sequential_view.current.last >= 0) { + return move.gcode_id == static_cast(m_sequential_view.gcode_ids[m_sequential_view.current.last]); + } + return false; }); if (it != m_gcode_result->moves.end()) m_sequential_view.marker.update_curr_move(*it);