Fixed None exception when no board is detected

This commit is contained in:
2025-12-27 11:38:09 +01:00
parent c7bb0c4812
commit 1511fefc94

View File

@@ -62,10 +62,13 @@ class DetectionService:
edges_prediction = result["edges"]
pieces_prediction = result["pieces"]
warped_corners, matrix = self.board_manager.process_frame(edges_prediction[0], frame, self.scale_size)
if matrix is None:
processed_frame = self.board_manager.process_frame(edges_prediction[0], frame, self.scale_size)
if processed_frame is None:
return None
warped_corners = processed_frame[0]
matrix = processed_frame[1]
detections = self.pieces_manager.extract_pieces(pieces_prediction)
board = self.pieces_manager.pieces_to_board(detections, warped_corners, matrix, self.scale_size)