From 2140e08c35ffda3b4279dc72b6dfad3de8b6c6aa Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Fri, 5 Aug 2022 13:39:51 +0200 Subject: some extra safeguards for invalid images --- .../src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java index 1322be06..558e45de 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java @@ -40,6 +40,9 @@ public class ImageConverter { if (bufferedImage == null) return null; + if ((bufferedImage.getWidth() <= 0) || (bufferedImage.getHeight() <= 0)) + return null; + if (bufferedImage.getColorModel() instanceof DirectColorModel) { DirectColorModel colorModel = (DirectColorModel) bufferedImage .getColorModel(); -- cgit v1.2.3