Don't try to set the zoom dropdown selection if it'd be out of bounds

Originally committed to SVN as r6928.
This commit is contained in:
Thomas Goyne 2012-07-05 23:05:34 +00:00
parent 2fb6b19e45
commit 3dc9e4fbea
1 changed files with 3 additions and 1 deletions

View File

@ -377,7 +377,9 @@ void VideoDisplay::OnKeyDown(wxKeyEvent &event) {
void VideoDisplay::SetZoom(double value) { void VideoDisplay::SetZoom(double value) {
zoomValue = std::max(value, .125); zoomValue = std::max(value, .125);
zoomBox->SetSelection(value / .125 - 1); size_t selIndex = value / .125 - 1;
if (selIndex < zoomBox->GetCount())
zoomBox->SetSelection(selIndex);
zoomBox->ChangeValue(wxString::Format("%g%%", zoomValue * 100.)); zoomBox->ChangeValue(wxString::Format("%g%%", zoomValue * 100.));
UpdateSize(); UpdateSize();
} }