Fix for crash from #7486 - PrusaSlicer crashes when doing this commands

This commit is contained in:
YuSanka 2021-12-13 16:19:58 +01:00
parent 2121a98bea
commit dc3da0b626
2 changed files with 4 additions and 0 deletions

View File

@ -181,6 +181,8 @@ public:
// we have to set same max contrtol width to all of them // we have to set same max contrtol width to all of them
void set_max_win_width(int max_win_width); void set_max_win_width(int max_win_width);
bool is_activated() { return sizer != nullptr; }
protected: protected:
std::map<t_config_option_key, Option> m_options; std::map<t_config_option_key, Option> m_options;
wxWindow* m_parent {nullptr}; wxWindow* m_parent {nullptr};

View File

@ -3933,6 +3933,8 @@ bool Tab::validate_custom_gcodes()
bool valid = true; bool valid = true;
for (auto opt_group : m_active_page->m_optgroups) { for (auto opt_group : m_active_page->m_optgroups) {
assert(opt_group->opt_map().size() == 1); assert(opt_group->opt_map().size() == 1);
if (!opt_group->is_activated())
break;
std::string key = opt_group->opt_map().begin()->first; std::string key = opt_group->opt_map().begin()->first;
valid &= validate_custom_gcode(opt_group->title, boost::any_cast<std::string>(opt_group->get_value(key))); valid &= validate_custom_gcode(opt_group->title, boost::any_cast<std::string>(opt_group->get_value(key)));
if (!valid) if (!valid)