From dc3da0b626261c3023515034fe4342350d5a9651 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 13 Dec 2021 16:19:58 +0100 Subject: [PATCH] Fix for crash from #7486 - PrusaSlicer crashes when doing this commands --- src/slic3r/GUI/OptionsGroup.hpp | 2 ++ src/slic3r/GUI/Tab.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 6647740dd..67c3fbdbd 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -181,6 +181,8 @@ public: // we have to set same max contrtol width to all of them void set_max_win_width(int max_win_width); + bool is_activated() { return sizer != nullptr; } + protected: std::map m_options; wxWindow* m_parent {nullptr}; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5d76054e5..f5fb4f82c 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3933,6 +3933,8 @@ bool Tab::validate_custom_gcodes() bool valid = true; for (auto opt_group : m_active_page->m_optgroups) { assert(opt_group->opt_map().size() == 1); + if (!opt_group->is_activated()) + break; std::string key = opt_group->opt_map().begin()->first; valid &= validate_custom_gcode(opt_group->title, boost::any_cast(opt_group->get_value(key))); if (!valid)