From 9b980858ef57ca7ff712e3090b5ec94f49964230 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 25 Feb 2025 22:09:45 +0100 Subject: Fix failure to use name format with the short output panel (#2646). Because we would do nothing when there are no _examples. --- src/wx/name_format_editor.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/wx/name_format_editor.cc b/src/wx/name_format_editor.cc index 166b0e145..ce0760486 100644 --- a/src/wx/name_format_editor.cc +++ b/src/wx/name_format_editor.cc @@ -73,20 +73,18 @@ NameFormatEditor::changed () void NameFormatEditor::update_example () { - if (_examples.empty ()) { - return; - } - _name.set_specification(wx_to_std(_specification->GetValue())); - auto example = wxString::Format(_("e.g. %s"), std_to_wx(careful_string_filter(_name.get(_examples, _suffix)))); - wxString wrapped; - for (size_t i = 0; i < example.Length(); ++i) { - if (i > 0 && (i % 40) == 0) { - wrapped += char_to_wx("\n"); + if (!_examples.empty()) { + auto example = wxString::Format(_("e.g. %s"), std_to_wx(careful_string_filter(_name.get(_examples, _suffix)))); + wxString wrapped; + for (size_t i = 0; i < example.Length(); ++i) { + if (i > 0 && (i % 40) == 0) { + wrapped += char_to_wx("\n"); + } + wrapped += example[i]; } - wrapped += example[i]; - } - _example->SetLabel (wrapped); + _example->SetLabel(wrapped); + } } -- cgit v1.2.3