Fix error after resizing the document if there was an action preview

If you confirmed the dialog with Enter after hovering over the canvas,
previously it got:

    IndexError: list index out of range

when canceling the preview after it became outdated in regard to the
canvas size.
This commit is contained in:
Isaiah Odhner 2023-05-02 17:54:42 -04:00
parent cbbaf18945
commit 77fa6cb444

View File

@ -2316,6 +2316,8 @@ class PaintApp(App[None]):
if width < 1 or height < 1:
raise ValueError
self.cancel_preview()
# TODO: DRY undo state creation (at least the undos/redos part)
action = Action(_("Attributes"), Region(0, 0, self.image.width, self.image.height))
action.is_resize = True