From 5059d131568e76c24bbe99c325c346e7e149c54a Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Sun, 12 Feb 2012 01:34:53 -0500 Subject: [PATCH] -handle case gracefully when pypo hasn't registered with Airtime server yet. --- .../application/models/Systemstatus.php | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index 5231ba350..601cbaa1f 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -120,23 +120,31 @@ class Application_Model_Systemstatus public static function GetPypoStatus(){ $component = CcServiceRegisterQuery::create()->findOneByDbName("pypo"); - $ip = $component->getDbIp(); - - $docRoot = self::GetMonitStatus($ip); - $data = self::ExtractServiceInformation($docRoot, "airtime-playout"); + if (is_null($component)){ + return null; + } else { + $ip = $component->getDbIp(); + + $docRoot = self::GetMonitStatus($ip); + $data = self::ExtractServiceInformation($docRoot, "airtime-playout"); - return $data; + return $data; + } } public static function GetLiquidsoapStatus(){ $component = CcServiceRegisterQuery::create()->findOneByDbName("pypo"); - $ip = $component->getDbIp(); - - $docRoot = self::GetMonitStatus($ip); - $data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap"); + if (is_null($component)){ + return null; + } else { + $ip = $component->getDbIp(); + + $docRoot = self::GetMonitStatus($ip); + $data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap"); - return $data; + return $data; + } } public static function GetShowRecorderStatus(){