Fix Server() not returning a ServerObject if not found when ServerId is null or 0

This commit is contained in:
Isaac Connor 2019-10-21 13:45:27 -04:00
parent 91651652c7
commit d036613776
1 changed files with 3 additions and 2 deletions

View File

@ -119,8 +119,9 @@ class Storage extends ZM_Object {
if ( array_key_exists('ServerId', $this) ) {
$this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'}));
if ( (!$this->{'Server'}) and $this->{'ServerId'} ) {
Error('No Server record found for server id ' . $this->{'ServerId'});
if ( !$this->{'Server'} ) {
if ( $this->{'ServerId'} )
Error('No Server record found for server id ' . $this->{'ServerId'});
$this->{'Server'} = new Server();
}
} else {