Fix crash while undoing with the menu on an empty annotation

BUGS: 453987
4 jobs for release/22.04 in 6 minutes and 44 seconds (queued for 1 second)