From 232bae36e7e35773743a6fc2d4416291be6c92ee Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 27 Mar 2012 00:48:47 +0000 Subject: [PATCH] Fix crash when the Accept button in the kanji timer is clicked at a time when there's nothing to accept Originally committed to SVN as r6609. --- aegisub/src/dialog_kara_timing_copy.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aegisub/src/dialog_kara_timing_copy.cpp b/aegisub/src/dialog_kara_timing_copy.cpp index 5aa707246..5edf5612e 100644 --- a/aegisub/src/dialog_kara_timing_copy.cpp +++ b/aegisub/src/dialog_kara_timing_copy.cpp @@ -786,10 +786,12 @@ void DialogKanjiTimer::OnGoBack(wxCommandEvent &) { } void DialogKanjiTimer::OnAccept(wxCommandEvent &) { + if (currentDestinationLine == subs->Line.end()) return; + if (display->GetRemainingSource() > 0) wxMessageBox(_("Group all of the source text."),_("Error"),wxICON_EXCLAMATION | wxOK); - else { - LinesToChange.push_back(std::make_pair(dynamic_cast(*currentDestinationLine), display->GetOutputLine())); + else if (AssDialogue *destLine = dynamic_cast(*currentDestinationLine)) { + LinesToChange.push_back(std::make_pair(destLine, display->GetOutputLine())); currentSourceLine = FindNextStyleMatch(currentSourceLine, SourceStyle->GetValue()); currentDestinationLine = FindNextStyleMatch(currentDestinationLine, DestStyle->GetValue());