From d0366137762bd215b0a2a566e94f9aab21fca0fb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 21 Oct 2019 13:45:27 -0400 Subject: [PATCH] Fix Server() not returning a ServerObject if not found when ServerId is null or 0 --- web/includes/Storage.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/includes/Storage.php b/web/includes/Storage.php index dec0f5a12..cf1e6ddcf 100644 --- a/web/includes/Storage.php +++ b/web/includes/Storage.php @@ -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 {