From 22eb226fbede1dda1a79e5be0ff4aa4657b3ae19 Mon Sep 17 00:00:00 2001 From: Ynjxsjmh Date: Sun, 29 Sep 2024 21:49:00 +0800 Subject: [PATCH] Fix index error due to missing previously selected shapes in current image --- labelme/widgets/canvas.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/labelme/widgets/canvas.py b/labelme/widgets/canvas.py index f383c3ea8..542d71668 100644 --- a/labelme/widgets/canvas.py +++ b/labelme/widgets/canvas.py @@ -988,7 +988,11 @@ def keyReleaseEvent(self, ev): if int(modifiers) == 0: self.snapping = True elif self.editing(): - if self.movingShape and self.selectedShapes: + if ( + self.movingShape + and self.selectedShapes + and self.selectedShapes[0] in self.shapes + ): index = self.shapes.index(self.selectedShapes[0]) if self.shapesBackups[-1][index].points != self.shapes[index].points: self.storeShapes()