From 19160226a9f9c02c3339471cd680de23edd14c7b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 25 Jul 2024 14:54:31 +0100 Subject: [PATCH] Check that image dimensions are returned --- media.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/media.py b/media.py index 0f87ecfc0..2016a37e8 100644 --- a/media.py +++ b/media.py @@ -782,8 +782,12 @@ def apply_watermark_to_image(base_dir: str, nickname: str, domain: str, # scale the watermark so that it is a fixed percentage of the image width post_image_width, _ = \ get_image_dimensions(post_image_filename) + if not post_image_width: + return False watermark_image_width, watermark_image_height = \ get_image_dimensions(post_image_filename) + if not watermark_image_width or not watermark_image_height: + return False scaled_watermark_image_width = \ int(post_image_width * watermark_width_percent / 100) scaled_watermark_image_height = \