Make sure that device_id is in _is_recording and hasn't been removed by another thread before checking it

This commit is contained in:
Fabio Manganiello 2019-03-17 02:16:41 +01:00
parent 9d36688a61
commit 81a200bd4e

View file

@ -270,7 +270,7 @@ class CameraPlugin(Plugin):
self.fire_event(CameraRecordingStartedEvent(**evt_args))
while self._is_recording[device_id].is_set():
while device_id in self._is_recording and self._is_recording[device_id].is_set():
if duration and time.time() - recording_started_time >= duration \
or n_frames and captured_frames >= n_frames:
break