From 81efd4082f40bdc78c7e1c8eb59edac06780fab7 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Thu, 23 Feb 2006 22:47:14 +0000 Subject: [PATCH] Attempting to load a file which does not exist no longer unloads previous subtitles. (Fix to bug #12) Originally committed to SVN as r133. --- core/changelog.txt | 1 + core/frame_main.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/core/changelog.txt b/core/changelog.txt index 3abc2513e..2803965e0 100644 --- a/core/changelog.txt +++ b/core/changelog.txt @@ -50,6 +50,7 @@ Please visit http://aegisub.net to download latest version - Added forums and bugtracker to Help menu. (AMZ) - Fixed Fonts Collector behavior with font shortcuts. (AMZ) - Better error reporting when loading Automation scripts (jfs) +- Attempting to load a file which does not exist no longer unloads previous subtitles. (AMZ) = 1.09 beta - 2006.01.16 =========================== diff --git a/core/frame_main.cpp b/core/frame_main.cpp index 7859714c5..050a12ab0 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -485,6 +485,13 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) { // Load try { + // File exists? + if (isFile) { + wxFileName fileCheck(filename); + if (!fileCheck.FileExists()) throw _T("File does not exist."); + } + + // Proceed into loading SubsBox->Clear(); AssFile::StackReset(); if (isFile) { @@ -501,6 +508,7 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) { } catch (AutomationError &err) { wxMessageBox(wxString(_T("Automation exception: ")) + err.message, _T("Error"), wxOK | wxICON_ERROR, NULL); + return; } catch (...) { wxMessageBox(_T("Unknown error"), _T("Error"), wxOK | wxICON_ERROR, NULL);