From 7a38c1c06e7a3436d46af3c7d709f8ece4511e52 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 11 Nov 2010 04:48:29 +0000 Subject: [PATCH] Add some bounds checking in the preferences dialog Originally committed to SVN as r4841. --- aegisub/src/preferences_base.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aegisub/src/preferences_base.cpp b/aegisub/src/preferences_base.cpp index 75ffff755..3b66052ea 100644 --- a/aegisub/src/preferences_base.cpp +++ b/aegisub/src/preferences_base.cpp @@ -170,7 +170,8 @@ void OptionPage::OptionChoice(wxFlexGridSizer *&flex, const wxString &name, cons switch (opt->GetType()) { case agi::OptionValue::Type_Int: { - cb->SetValue(choices[opt->GetInt()]); + int val = opt->GetInt(); + cb->SetValue(choices[val < (int)choices.size() ? val : opt->GetDefaultInt()]); cb->Bind(wxEVT_COMMAND_COMBOBOX_SELECTED, IntCBUpdater(opt_name, parent)); break; }