X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Flanguage_tag_dialog.cc;h=ca08996c681d01a5d2c47b24ecbfd9000948316b;hb=29196ecc58f92432c21bac47dc5a59c6408524b4;hp=c72c64b313c07f0465553d297a5ac0973fe0d816;hpb=e0a70cd5cfb11fc2de167f3146acdd437a6faa82;p=dcpomatic.git diff --git a/src/wx/language_tag_dialog.cc b/src/wx/language_tag_dialog.cc index c72c64b31..ca08996c6 100644 --- a/src/wx/language_tag_dialog.cc +++ b/src/wx/language_tag_dialog.cc @@ -116,7 +116,9 @@ LanguageTagDialog::set (dcp::LanguageTag tag) _custom.push_back (tag); selection = _presets.size() + _custom.size() - 1; populate_list (); - _list->EnsureVisible (_list->GetItemCount() - 1); + if (_list->GetItemCount() > 0) { + _list->EnsureVisible (_list->GetItemCount() - 1); + } } else { selection = _presets.size() + std::distance(_custom.begin(), iter); } @@ -125,7 +127,9 @@ LanguageTagDialog::set (dcp::LanguageTag tag) } _list->SetItemState (selection, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); - _list->EnsureVisible (selection); + if (static_cast(selection) < _list->GetItemCount()) { + _list->EnsureVisible (selection); + } }