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.
This commit is contained in:
Karl Blomster 2010-09-15 01:00:18 +00:00
parent 0c2b40dc60
commit 9108ea9b00

View file

@ -771,8 +771,8 @@ wxString AssFile::GetWildcardList(int mode) {
int AssFile::Commit(wxString desc, int amendId) { int AssFile::Commit(wxString desc, int amendId) {
++commitId; ++commitId;
// Allow coalescing only if it's the last change and the file has not been // Allow coalescing only if it's the last change and the file has not been
// saved since the last change // saved since the last change and the undo stack isn't empty
if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId) { if (commitId == amendId+1 && RedoStack.empty() && savedCommitId != commitId && !UndoStack.empty()) {
UndoStack.back() = *this; UndoStack.back() = *this;
return commitId; return commitId;
} }