From 9108ea9b00590adeb1ee1aa0715b612c856ddb1a Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Wed, 15 Sep 2010 01:00:18 +0000 Subject: [PATCH] Don't try to coalesce undo operations when there aren't any undo operations to coalesce with. Fixes a crash when opening .txt files. Originally committed to SVN as r4784. --- aegisub/src/ass_file.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aegisub/src/ass_file.cpp b/aegisub/src/ass_file.cpp index 578938739..ec0058bd2 100644 --- a/aegisub/src/ass_file.cpp +++ b/aegisub/src/ass_file.cpp @@ -771,8 +771,8 @@ wxString AssFile::GetWildcardList(int mode) { int AssFile::Commit(wxString desc, int amendId) { ++commitId; // Allow coalescing only if it's the last change and the file has not been - // saved since the last change - if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId) { + // saved since the last change and the undo stack isn't empty + if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId && !UndoStack.empty()) { UndoStack.back() = *this; return commitId; }