diff --git a/docs/changes.txt b/docs/changes.txt index 23d6477b0b..2f4cf6956a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -322,6 +322,7 @@ wxOSX: wxUniv: - Fix resetting the hint in wxTextCtrl when it gets focus (Kvaz1r, #23511). +- Fix creating wxRadioBox without any items (Kvaz1r, #23784). 3.2.2.1: (released 2023-02-13) diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index 4db3b47510..6d6c791540 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -162,8 +162,10 @@ bool wxRadioBox::Create(wxWindow *parent, wxSize actualSize = GetSize(); DoMoveWindow(actualPos.x, actualPos.y, actualSize.x, actualSize.y); - // radiobox should already have selection so select at least one item - SetSelection(0); + // Select first radio button if we have any buttons at all, as the radiobox + // should always have some selection. + if ( n != 0 ) + SetSelection(0); return true; }