Skip to content

Commit e40835e

Browse files
committed
mp_image: add check that tracker is not None
Signed-off-by: Rhys Mainwaring <[email protected]>
1 parent 8c007d1 commit e40835e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

MAVProxy/modules/lib/mp_image.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,11 @@ def video_thread(self, url, cap_options):
697697

698698
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
699699
(width, height) = (frame.shape[1], frame.shape[0])
700-
if self.tracker:
700+
if self.tracker is not None:
701701
self.tracker.update(frame)
702+
# TODO: may need a lock? tracker may be set to None after update()
703+
# but before get_position().
704+
if self.tracker is not None:
702705
pos = self.tracker.get_position()
703706
if pos is not None:
704707
startX = int(pos.left())

0 commit comments

Comments
 (0)