diff --git a/src/Message.php b/src/Message.php index 7e8c43a..30fdc3b 100644 --- a/src/Message.php +++ b/src/Message.php @@ -324,7 +324,7 @@ public function getText(): ?string */ public function setText(?string $text): void { - if (preg_match('//u', $text) !== 1) { + if (preg_match('//u', $text ?? '') !== 1) { throw new InvalidArgumentException("message body contains an invalid UTF-8 byte sequence"); } @@ -346,7 +346,7 @@ public function getHTML(): ?string */ public function setHTML(?string $html): void { - if (preg_match('//u', $html) !== 1) { + if (preg_match('//u', $html ?? '') !== 1) { throw new InvalidArgumentException("message body contains an invalid UTF-8 byte sequence"); }