From 2f295a2f55c3657d1410192f61c5100ec998f793 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 30 Sep 2022 09:57:21 -0400 Subject: [PATCH] Make Monitor::Server always return a Server object so we don't have to test for null --- web/includes/Monitor.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/includes/Monitor.php b/web/includes/Monitor.php index f918a7ba2..3b3f03465 100644 --- a/web/includes/Monitor.php +++ b/web/includes/Monitor.php @@ -299,8 +299,12 @@ public static function getStatuses() { public function Server() { if (!property_exists($this, 'Server')) { - if ($this->ServerId()) + if ($this->ServerId()) { $this->{'Server'} = Server::find_one(array('Id'=>$this->{'ServerId'})); + if (!$this->{'Server'}) { + $this->{'Server'} = new Server(); + } + } if (!property_exists($this, 'Server')) { $this->{'Server'} = new Server(); }