Skip to content

Commit 71c1c48

Browse files
committed
Better handling of empty images.
1 parent b576864 commit 71c1c48

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/qz/printer/action/PrintRaw.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ private ImageWrapper getHtmlWrapper(String data, JSONObject opt, PrintingUtiliti
265265
return getWrapper(bi, opt, pxlOpts);
266266
}
267267

268-
private ImageWrapper getWrapper(BufferedImage img, JSONObject opt, PrintOptions.Pixel pxlOpts) {
268+
private ImageWrapper getWrapper(BufferedImage img, JSONObject opt, PrintOptions.Pixel pxlOpts) throws IOException {
269+
if(img == null) {
270+
throw new IOException("Image provided is empty or null and cannot be converted.");
271+
}
269272
// Rotate image using orientation or rotation before sending to ImageWrapper
270273
if (pxlOpts.getOrientation() != null && pxlOpts.getOrientation() != PrintOptions.Orientation.PORTRAIT) {
271274
img = PrintImage.rotate(img, pxlOpts.getOrientation().getDegreesRot(), pxlOpts.getDithering(), pxlOpts.getInterpolation());

0 commit comments

Comments
 (0)