From 0fcee2b2c4729c4b4dc752382ebefef76ff7c952 Mon Sep 17 00:00:00 2001 From: heathdutton Date: Thu, 10 May 2018 22:50:48 -0400 Subject: [PATCH] Prevent exception when trying to log an exception without a specific source. --- Model/Api.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Model/Api.php b/Model/Api.php index 7e1defb..0961cb6 100644 --- a/Model/Api.php +++ b/Model/Api.php @@ -32,7 +32,6 @@ use Symfony\Component\DependencyInjection\Container; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Yaml\Yaml; /** * Class Api. @@ -1355,7 +1354,6 @@ private function logResults() $this->contactSource, $this->status, $this->contact, - //Yaml::dump($this->logs, 10, 2), $this->getLogsJSON(), $message ); @@ -1376,7 +1374,10 @@ private function logResults() } } // File-based logging. - $this->logger->log($statLevel, 'Contact Source '.$this->contactSource->getId().': '.$message); + $this->logger->log( + $statLevel, + 'Contact Source '.($this->contactSource ? $this->contactSource->getId() : 'NA').': '.$message + ); } /**