From cf4ac74d02beeae8104159862371811ca1d6ead0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 24 Jan 2018 10:45:42 -0500 Subject: [PATCH] If failed to delete from Frames or Stats, return instead of deleting the event. --- scripts/ZoneMinder/lib/ZoneMinder/Event.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm index 43bff549e..530aa4f5c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm @@ -357,6 +357,9 @@ sub delete { my $res = $sth->execute( $event->{Id} ) or Error( "Can't execute '$sql': ".$sth->errstr() ); $sth->finish(); + if ( $ZoneMinder::Database::dbh->errstr() ) { + return; + } $sql = 'DELETE FROM Stats WHERE EventId=?'; $sth = $ZoneMinder::Database::dbh->prepare_cached( $sql ) @@ -364,6 +367,9 @@ sub delete { $res = $sth->execute( $event->{Id} ) or Error( "Can't execute '$sql': ".$sth->errstr() ); $sth->finish(); + if ( $ZoneMinder::Database::dbh->errstr() ) { + return; + } $event->delete_files( ); } else {