From 350f9187bf3df8b37fec2101340bb5bd3ba9d102 Mon Sep 17 00:00:00 2001 From: Frank Wittchow Date: Wed, 16 Jan 2019 14:49:10 +0100 Subject: [PATCH] 1.0.3 - Fixed Undefined index Exception --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/services/HandleException.php | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c66970..3e77b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.3 - 2019-01-16 +### Fixed +- Fixed Undefined index Exception + ## 1.0.2 - 2018-09-06 ### Fixed - Check if $ _SESSION is set, to avoid "Undefined variable: _SESSION in.." diff --git a/composer.json b/composer.json index 5236455..5b0f3d5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "bitboxde/error-notifier", "description": "Sending an email if an error occurred.", "type": "craft-plugin", - "version": "1.0.2", + "version": "1.0.3", "keywords": [ "craft", "cms", diff --git a/src/services/HandleException.php b/src/services/HandleException.php index e99165d..be66e0f 100644 --- a/src/services/HandleException.php +++ b/src/services/HandleException.php @@ -45,13 +45,15 @@ public function handleException($exception) ); $view->setTemplatesPath($oldTemplatesPath); - $message = new Message(); - $message->setFrom([$this->pluginSettings->sender => $this->settings['fromName']]); - $message->setTo($recievers); - $message->setSubject($this->pluginSettings->emailPrefix .' - ' . $this->settings['fromName'] . ' - ' . $this->getExceptionName($exception)); - $message->setHtmlBody($body); - - Craft::$app->mailer->send($message); + if(array_key_exists('fromName', $this->settings)) { + $message = new Message(); + $message->setFrom([$this->pluginSettings->sender => $this->settings['fromName']]); + $message->setTo($recievers); + $message->setSubject($this->pluginSettings->emailPrefix .' - ' . $this->settings['fromName'] . ' - ' . $this->getExceptionName($exception)); + $message->setHtmlBody($body); + + Craft::$app->mailer->send($message); + } } }