Fix IndexError when undoing all the way

This commit is contained in:
Isaiah Odhner 2023-09-10 02:20:11 -04:00
parent 402b46c7df
commit 1a53a18912

View File

@ -117,10 +117,10 @@ class PilotRecorder():
self.steps_changed()
elif isinstance(event, Key):
if event.key == "ctrl+z" and self.steps:
while isinstance(self.steps[-1][0], (MouseMove, MouseUp)):
while self.steps and isinstance(self.steps[-1][0], (MouseMove, MouseUp)):
self.steps.pop()
self.steps.pop()
while isinstance(self.steps[-1][0], MouseMove):
while self.steps and isinstance(self.steps[-1][0], MouseMove):
self.steps.pop()
self.steps_changed()