From d1d102c1d2fe654ef3fe0defa423e1ca7f77112e Mon Sep 17 00:00:00 2001 From: Lukas Gaechter Date: Tue, 3 Sep 2024 16:20:49 +0200 Subject: [PATCH] fix: Fix bug when Timmy::get_image() is called with null as the attachment parameter --- lib/Timmy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Timmy.php b/lib/Timmy.php index a3a9de4..8b10712 100644 --- a/lib/Timmy.php +++ b/lib/Timmy.php @@ -136,6 +136,10 @@ public static function get_image( $attachment, $size ) { $attachment = (int) $attachment['ID']; } + if (!$attachment) { + return null; + } + // Check if we work with a WordPress post. This doesn’t necessarily have // to be an attachment, that’s why we don’t check for the 'attachment' // post type.