From 3eaf9f4011573c6ff41c70de21f835f9d4c52034 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 11 Aug 2024 06:32:39 -0600 Subject: [PATCH] Catch case where user tries to end definite manual event (#12951) * Catch case where user tries to end definite manual event * Formatting --- frigate/review/maintainer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index 8fb1df362..dfc7259b2 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -503,8 +503,15 @@ class ReviewSegmentMaintainer(threading.Thread): # temporarily make it so this event can not end current_segment.last_update = sys.maxsize elif manual_info["state"] == ManualEventState.end: - self.indefinite_events[camera].pop(manual_info["event_id"]) - current_segment.last_update = manual_info["end_time"] + event_id = manual_info["event_id"] + + if event_id in self.indefinite_events[camera]: + self.indefinite_events[camera].pop(event_id) + current_segment.last_update = manual_info["end_time"] + else: + logger.error( + f"Event with ID {event_id} has a set duration and can not be ended manually." + ) else: if topic == DetectionTypeEnum.video: self.check_if_new_segment(