Closed AreChen closed 1 month ago
Hi, thank you for bringing this issue to our attention.
For further details or assistance with this matter, please try the following:
try:
xxx
except ValueError:
# Handle the potential error appropriately
print("Selected shape not found in the list of shapes.")
You can resubmit according to the requirements. If there are no issues, I will merge this PR after the next modification. Thank you again for your support of X-AnyLabeling.
在调整OBB框体时,有时候会触发以下报错,导致程序崩溃
从 self.shapes 列表中找到 self.selected_shapes[0] 的索引,但是 self.selected_shapes[0] 并不存在于 self.shapes 列表中。这种情况通常发生在以下几种情况:
对象不匹配:self.selected_shapes[0] 可能已经从 self.shapes 中被移除,或者被修改过,导致无法通过 index() 方法找到相同的对象。
逻辑错误:在某些操作中可能意外地修改了 self.shapes 或 self.selected_shapes,导致两者不同步。
为了解决这个问题,采取了以下步骤:
检查和修正对象的管理 确保在任何操作中,self.shapes 和 self.selected_shapes 都正确地被更新和维护。例如,在删除或添加形状时,确保这两个列表都得到相应的更新。
增加异常处理 在尝试获取索引之前,首先检查对象是否存在于列表中。