Skip to content

Commit

Permalink
Ensure unicodeToShortcode receives a string
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Jun 13, 2023
1 parent 3271dd3 commit d55d19f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Campaign

## 2.8.3 - Unreleased
### Fixed
Fixed a bug that was causing errors when updating search indexes when a sendout’s subject was not set ([#397](https://github.com/putyourlightson/craft-campaign/issues/397)).

## 2.8.2 - 2023-06-12
### Fixed
Fixed a bug in which Campaign dashboard widgets were throwing exceptions when a date range was set ([#396](https://github.com/putyourlightson/craft-campaign/issues/396)).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "putyourlightson/craft-campaign",
"description": "Send and manage email campaigns, contacts and mailing lists.",
"version": "2.8.2",
"version": "2.8.3",
"type": "craft-plugin",
"homepage": "https://putyourlightson.com/plugins/campaign",
"license": "proprietary",
Expand Down
4 changes: 2 additions & 2 deletions src/elements/SendoutElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ public function getPlaintextBody(): ?string
public function getSearchKeywords(string $attribute): string
{
if ($attribute == 'subject') {
return LitEmoji::unicodeToShortcode($this->{$attribute});
return LitEmoji::unicodeToShortcode($this->{$attribute} ?? '');
}

return parent::getSearchKeywords($attribute);
Expand Down Expand Up @@ -1259,7 +1259,7 @@ public function beforeSave(bool $isNew): bool

if (Craft::$app->getDb()->getIsMysql()) {
// Encode subject for emojis
$this->subject = LitEmoji::unicodeToShortcode($this->subject);
$this->subject = LitEmoji::unicodeToShortcode($this->subject ?? '');
}

if (Campaign::$plugin->settings->showSendoutTitleField === false) {
Expand Down

0 comments on commit d55d19f

Please sign in to comment.