From 2ff1e7ed6d3fc5495ab370c20fcf73bd25873005 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 16 Apr 2019 11:30:18 -0400 Subject: [PATCH] Fix crash when reporting an event longer than section length when event was just closed so event is null. --- src/zm_monitor.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 5240393c3..204284cd5 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1715,20 +1715,22 @@ bool Monitor::Analyse() { else event->AddFrame(snap_image, *timestamp, score); } - if ( event && noteSetMap.size() > 0 ) - event->updateNotes(noteSetMap); + if ( event ) { + if ( noteSetMap.size() > 0 ) + event->updateNotes(noteSetMap); - if ( section_length - && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length ) - && ! (image_count % fps_report_interval) - ) { - Warning("%s: %03d - event %" PRIu64 ", has exceeded desired section length. %d - %d = %d >= %d", - name, image_count, event->Id(), - timestamp->tv_sec, video_store_data->recording.tv_sec, - timestamp->tv_sec - video_store_data->recording.tv_sec, - section_length - ); - } + if ( section_length + && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length ) + && ! (image_count % fps_report_interval) + ) { + Warning("%s: %03d - event %" PRIu64 ", has exceeded desired section length. %d - %d = %d >= %d", + name, image_count, event->Id(), + timestamp->tv_sec, video_store_data->recording.tv_sec, + timestamp->tv_sec - video_store_data->recording.tv_sec, + section_length + ); + } + } // end if event } else if ( state == ALERT ) { event->AddFrame(snap_image, *timestamp);