diff --git a/src/tagstudio/qt/controllers/tiles/color_data.py b/src/tagstudio/qt/controllers/tiles/color_data.py index a9489208..4b311f2d 100644 --- a/src/tagstudio/qt/controllers/tiles/color_data.py +++ b/src/tagstudio/qt/controllers/tiles/color_data.py @@ -59,8 +59,10 @@ class ColorData(TileData): max_width = 60 color_widgets: list[TagColorLabel] = [] - while (item := self.layout().itemAt(0)) and (widget := item.widget()): - widget.deleteLater() + layout = self.layout() + while item := layout.takeAt(0): + if widget := item.widget(): + widget.deleteLater() for color in colors_: color_widget = TagColorLabel(