From 71f641d64900e8ab74c7ff1ef0e26c55cec45290 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Fri, 11 Jan 2008 03:33:23 +0000 Subject: [PATCH] Fixed #550 Originally committed to SVN as r1681. --- aegisub/dialog_resample.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/aegisub/dialog_resample.cpp b/aegisub/dialog_resample.cpp index 2dd572cf5..daf4dd907 100644 --- a/aegisub/dialog_resample.cpp +++ b/aegisub/dialog_resample.cpp @@ -200,18 +200,22 @@ void DialogResample::OnResample (wxCommandEvent &event) { ResX->GetValue().ToLong(&x2); ResY->GetValue().ToLong(&y2); + // Sanity check + if (x1 == 0 || y1 == 0) { + wxMessageBox(_T("Invalid source resolution. This should not happen. Please contact the developers."),_("Error"),wxCENTRE|wxICON_ERROR); + return; + } + if (x2 == 0 || y2 == 0) { + wxMessageBox(_("Invalid resolution: destination resolution cannot be 0 on either dimension."),_("Error"),wxCENTRE|wxICON_ERROR); + return; + } + // Get margins MarginLeft->GetValue().ToLong(&m[0]); MarginRight->GetValue().ToLong(&m[1]); MarginTop->GetValue().ToLong(&m[2]); MarginBottom->GetValue().ToLong(&m[3]); - // Check for validity - if (x1 == 0 || x2 == 0 || y1 == 0 || y2 == 0) { - EndModal(0); - return; - } - // Add margins to original resolution x1 += m[0] + m[1]; x2 += m[2] + m[3];