Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undostack: Fix segfault when trying to fetch macro on -1 index
Currently, if user adds a command to the undostack, and then removes it, and then adds another command - this causes a segfault, because the current undo position pointer of undostack is being moved to -1. This patch removes a possibility of this segfault by clearing macros and commands vector. If user has undo'd all commands (their position is at -1), then it means that whenever eraseRedundantCmds() is called, a macro or command has been pushed. If that happened, then we clear every command that's currently in "undo" state. In this case everything to the right is in undo state, so we simply need to clear everything.
- Loading branch information