浏览代码

Handle when pixmap is not set yet

Kentaro Wada 1 年之前
父节点
当前提交
390d32c044
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      labelme/widgets/canvas.py

+ 4 - 0
labelme/widgets/canvas.py

@@ -153,6 +153,10 @@ class Canvas(QtWidgets.QWidget):
                 ),
             )
 
+        if self.pixmap is None:
+            logger.warning("Pixmap is not set yet")
+            return
+
         self._ai_model.set_image(
             image=labelme.utils.img_qt_to_arr(self.pixmap.toImage())
         )