Skip to content

Commit

Permalink
Don't crash if there is some empty lines in the ui layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Dec 23, 2023
1 parent bbb2080 commit 17b1825
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/slic3r/GUI/OG_CustomCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ void OG_CustomCtrl::CtrlLine::update_visibility(ConfigOptionMode mode)
{
if (og_line.is_separator())
return;
const std::vector<Option>& option_set = og_line.get_options();
const std::vector<Option> &option_set = og_line.get_options();
if (option_set.empty())
return;

ConfigOptionMode line_mode = option_set.front().opt.mode;
for (const Option& opt : option_set)
Expand Down Expand Up @@ -639,6 +641,9 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
render_separator(dc, v_pos);
return;
}
if (og_line.get_options().empty())
return;

rects_tooltip.clear(); // reset the tooltip detection area, they are re-created by draw_text

Field* front_field = og_line.get_options().empty() ? nullptr : ctrl->opt_group->get_field(og_line.get_options().front().opt_id);
Expand Down Expand Up @@ -781,7 +786,7 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)

wxCoord OG_CustomCtrl::CtrlLine::draw_mode_bmp(wxDC& dc, wxCoord v_pos)
{
if (!m_has_icon)
if (!m_has_icon || og_line.is_separator() || og_line.get_options().empty())
return 0;
if (!draw_mode_bitmap)
return ctrl->m_h_gap;
Expand Down

0 comments on commit 17b1825

Please sign in to comment.