From 82f022b1f3fe8a3a535be612c19eb37cabb2d32a Mon Sep 17 00:00:00 2001 From: Rias Date: Mon, 21 May 2018 10:40:54 +0200 Subject: [PATCH] Fix error when returning null --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/models/TelegramChannel.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d129b..e915831 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.0.1 - 2018-05-21 +### Fixed +- Fixed an issue when returning `null` from `toTelegram()` + ## 1.0.0 - 2018-01-23 ### Added - Initial release diff --git a/composer.json b/composer.json index 6da2633..b025ea5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "rias/craft-telegram-notification-channel", "description": "A Telegram notification channel for the Craft Notifications plugin", "type": "craft-plugin", - "version": "1.0.0", + "version": "1.0.1", "keywords": [ "craft", "cms", diff --git a/src/models/TelegramChannel.php b/src/models/TelegramChannel.php index 2dbd1cd..ec87038 100644 --- a/src/models/TelegramChannel.php +++ b/src/models/TelegramChannel.php @@ -34,6 +34,11 @@ public function send($notifiable, Notification $notification) { $message = $notification->toTelegram(); + // If we don't get any message back, return. + if (is_null($message)) { + return; + } + if (is_string($message)) { $message = TelegramMessage::create($message); }