check for db connection before assuming that dbh is valid

This commit is contained in:
Isaac Connor 2016-05-10 11:11:45 -04:00
parent aebfa5c237
commit aaa4b3a824
1 changed files with 1 additions and 2 deletions

View File

@ -78,8 +78,7 @@ sub zmDbConnect
{ {
zmDbDisconnect(); zmDbDisconnect();
} }
if ( !defined( $dbh ) ) if ( ( ! defined( $dbh ) ) or ! $dbh->ping() ) {
{
my ( $host, $port ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); my ( $host, $port ) = ( $ZoneMinder::Config::Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
if ( defined($port) ) if ( defined($port) )