From aaa4b3a82456a253e8547ce8419186e9189efefd Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 10 May 2016 11:11:45 -0400 Subject: [PATCH] check for db connection before assuming that dbh is valid --- scripts/ZoneMinder/lib/ZoneMinder/Database.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm index 574c382f5..c49e291ac 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Database.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Database.pm @@ -78,8 +78,7 @@ sub zmDbConnect { zmDbDisconnect(); } - if ( !defined( $dbh ) ) - { + if ( ( ! defined( $dbh ) ) or ! $dbh->ping() ) { my ( $host, $port ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); if ( defined($port) )