From 8118d790a459dc53525ef3d87d7f6cf433509db2 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Mon, 4 Feb 2013 19:26:54 -0800 Subject: [PATCH] Don't display an error message if user cancels the charset selection dialog --- aegisub/src/subs_controller.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aegisub/src/subs_controller.cpp b/aegisub/src/subs_controller.cpp index f0d0c9e5a..d4ca914ed 100644 --- a/aegisub/src/subs_controller.cpp +++ b/aegisub/src/subs_controller.cpp @@ -86,8 +86,13 @@ void SubsController::Load(agi::fs::path const& filename, std::string charset) { // TextFileReader does this automatically, but relying on that results in // the user being prompted twice if it can't be auto-detected, since we // open the file twice below. - if (charset.empty()) - charset = CharSetDetect::GetEncoding(filename); + try { + if (charset.empty()) + charset = CharSetDetect::GetEncoding(filename); + } + catch (agi::UserCancelException const&) { + return; + } // Make sure that file isn't actually a timecode file if (charset != "binary") {