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.
This commit is contained in:
Thomas Goyne 2012-03-27 00:48:47 +00:00
parent f9e8d89059
commit 232bae36e7

View file

@ -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<AssDialogue*>(*currentDestinationLine), display->GetOutputLine()));
else if (AssDialogue *destLine = dynamic_cast<AssDialogue*>(*currentDestinationLine)) {
LinesToChange.push_back(std::make_pair(destLine, display->GetOutputLine()));
currentSourceLine = FindNextStyleMatch(currentSourceLine, SourceStyle->GetValue());
currentDestinationLine = FindNextStyleMatch(currentDestinationLine, DestStyle->GetValue());