diff --git a/src/Attachment.php b/src/Attachment.php index 38190fa..71eef6b 100644 --- a/src/Attachment.php +++ b/src/Attachment.php @@ -81,6 +81,10 @@ public function save(string $path): false|int */ public function extension(): ?string { + if (! $this->filename) { + return null; + } + if ($ext = pathinfo($this->filename, PATHINFO_EXTENSION)) { return $ext; }