fix: guard against empty option_set in OG_CustomCtrl widget-only lines

update_visibility() and render() both called front() on an empty vector
when a CtrlLine had no options (pure widget lines). Added an early-return
path in update_visibility() and a null-guard in render().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Clifford Garwood
2026-04-14 09:17:23 -04:00
co-authored by Claude Sonnet 4.6
parent ad0b42fd37
commit 857bfbfb82
+15 -1
View File
@@ -723,6 +723,19 @@ void OG_CustomCtrl::CtrlLine::update_visibility(ConfigOptionMode mode)
return;
const std::vector<Option>& option_set = og_line.get_options();
// Widget-only lines (no options appended) are always visible unless explicitly hidden.
if (option_set.empty()) {
is_visible = og_line.toggle_visible;
if (og_line.near_label_widget_win)
og_line.near_label_widget_win->Show(is_visible);
if (og_line.widget_sizer)
og_line.widget_sizer->ShowItems(is_visible);
if (og_line.extra_widget_sizer)
og_line.extra_widget_sizer->ShowItems(is_visible);
correct_items_positions();
return;
}
const ConfigOptionMode& line_mode = option_set.front().opt.mode;
is_visible = og_line.toggle_visible && line_mode <= mode;
@@ -773,7 +786,8 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos)
return;
}
Field* field = ctrl->opt_group->get_field(og_line.get_options().front().opt_id);
Field* field = og_line.get_options().empty() ? nullptr :
ctrl->opt_group->get_field(og_line.get_options().front().opt_id);
bool suppress_hyperlinks = false;
if (draw_just_act_buttons) {