Make Monitor::Server always return a Server object so we don't have to test for null

This commit is contained in:
Isaac Connor committed 2022-09-30 09:57:21 -04:00
1 parent caedd94f69
commit 2f295a2f55
1 file changed
+5 -1
+5 -1
View File
@@ -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();
}