Fix Server() not returning a ServerObject if not found when ServerId is null or 0
This commit is contained in:
parent
91651652c7
commit
d036613776
|
@ -119,8 +119,9 @@ class Storage extends ZM_Object {
|
||||||
if ( array_key_exists('ServerId', $this) ) {
|
if ( array_key_exists('ServerId', $this) ) {
|
||||||
$this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'}));
|
$this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'}));
|
||||||
|
|
||||||
if ( (!$this->{'Server'}) and $this->{'ServerId'} ) {
|
if ( !$this->{'Server'} ) {
|
||||||
Error('No Server record found for server id ' . $this->{'ServerId'});
|
if ( $this->{'ServerId'} )
|
||||||
|
Error('No Server record found for server id ' . $this->{'ServerId'});
|
||||||
$this->{'Server'} = new Server();
|
$this->{'Server'} = new Server();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue