diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-05 13:39:51 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-08-05 13:39:51 +0200 |
commit | 2140e08c35ffda3b4279dc72b6dfad3de8b6c6aa (patch) | |
tree | 9185d47065c66453e995443e0128db67aefdfe5a /pdf-over-gui | |
parent | 8e6acd9237c2458c66f8c747a64a1feb68172b35 (diff) | |
download | pdf-over-2140e08c35ffda3b4279dc72b6dfad3de8b6c6aa.tar.gz pdf-over-2140e08c35ffda3b4279dc72b6dfad3de8b6c6aa.tar.bz2 pdf-over-2140e08c35ffda3b4279dc72b6dfad3de8b6c6aa.zip |
some extra safeguards for invalid images
Diffstat (limited to 'pdf-over-gui')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/ImageConverter.java | 3 |
1 files changed, 3 insertions, 0 deletions
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(); |