diff --git a/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxImage.java b/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxImage.java index c9402db0e..13b3e0664 100644 --- a/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxImage.java +++ b/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxImage.java @@ -29,11 +29,12 @@ public PdfBoxImage(byte[] image, String uri) throws IOException { _bytes = image; _uri = uri; - ImageInputStream in = ImageIO - .createImageInputStream(new ByteArrayInputStream(_bytes)); + ImageInputStream in = null; ImageReader reader = null; try { + in = ImageIO + .createImageInputStream(new ByteArrayInputStream(_bytes)); Iterator readers = ImageIO.getImageReaders(in); if (readers.hasNext()) {