From 072cf476024eda2c61ad2e8516ef23f497c04642 Mon Sep 17 00:00:00 2001 From: Ynjxsjmh Date: Sun, 29 Sep 2024 21:56:28 +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 d71a6125b..2f6041596 100644 --- a/labelme/widgets/canvas.py +++ b/labelme/widgets/canvas.py @@ -963,7 +963,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()