Fix Undo command

The Undo command broke in 48dff11 when the `onModify` hook got added to
its execution in order to fix #2213. The reason for it begin broke is
that a Task object is created in an unsafe manner because the `prior`
task may be empty.
Catching this case fixes the bug.
This commit is contained in:
Max Rossmannek 2020-11-21 14:38:15 +01:00 committed by Tomas Babej
parent 50cfd92ad5
commit 44bcd58051

View file

@ -839,7 +839,9 @@ void TDB2::revert ()
// - erase from completed
// - if in backlog, erase, else cannot undo
Task old = Task (prior);
Task old = Task ();
if (prior != "")
old = Task (prior);
Context::getContext ().hooks.onModify (Task (current), old);
// Modify other data files accordingly.