Fix crash when reporting an event longer than section length when event was just closed so event is null.

This commit is contained in:
Isaac Connor 2019-04-16 11:30:18 -04:00
parent 98a9c68b8b
commit 2ff1e7ed6d
1 changed files with 15 additions and 13 deletions

View File

@ -1715,20 +1715,22 @@ bool Monitor::Analyse() {
else else
event->AddFrame(snap_image, *timestamp, score); event->AddFrame(snap_image, *timestamp, score);
} }
if ( event && noteSetMap.size() > 0 ) if ( event ) {
event->updateNotes(noteSetMap); if ( noteSetMap.size() > 0 )
event->updateNotes(noteSetMap);
if ( section_length if ( section_length
&& ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length ) && ( ( timestamp->tv_sec - video_store_data->recording.tv_sec ) >= section_length )
&& ! (image_count % fps_report_interval) && ! (image_count % fps_report_interval)
) { ) {
Warning("%s: %03d - event %" PRIu64 ", has exceeded desired section length. %d - %d = %d >= %d", Warning("%s: %03d - event %" PRIu64 ", has exceeded desired section length. %d - %d = %d >= %d",
name, image_count, event->Id(), name, image_count, event->Id(),
timestamp->tv_sec, video_store_data->recording.tv_sec, timestamp->tv_sec, video_store_data->recording.tv_sec,
timestamp->tv_sec - video_store_data->recording.tv_sec, timestamp->tv_sec - video_store_data->recording.tv_sec,
section_length section_length
); );
} }
} // end if event
} else if ( state == ALERT ) { } else if ( state == ALERT ) {
event->AddFrame(snap_image, *timestamp); event->AddFrame(snap_image, *timestamp);