X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Flanguage_tag_dialog.cc;h=df2b74976649d2d90aa951f8e8ea5d359e6290df;hb=865316f0129c85cdd0248b87502fe97dec94b3f0;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..df2b74976 100644 --- a/src/wx/language_tag_dialog.cc +++ b/src/wx/language_tag_dialog.cc @@ -23,9 +23,12 @@ #include "language_tag_dialog.h" #include "wx_util.h" #include "lib/config.h" +#include +#include +LIBDCP_DISABLE_WARNINGS #include #include -#include +LIBDCP_ENABLE_WARNINGS using std::vector; @@ -116,7 +119,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 +130,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); + } }