Skip to content

Commit

Permalink
Fix issue with unchecked iterator-element (#1595)
Browse files Browse the repository at this point in the history
  • Loading branch information
speckyspooky authored and merks committed Mar 14, 2024
1 parent 6d889f6 commit d4fdf93
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -733,11 +733,14 @@ private int[] getImageResolution(InputStream imageStream) {
try {
ImageInputStream iis = ImageIO.createImageInputStream(imageStream);
Iterator<ImageReader> i = ImageIO.getImageReaders(iis);
ImageReader r = i.next();
r.setInput(iis);
r.read(0);

IIOMetadata meta = r.getImageMetadata(0);
ImageReader r = null;
IIOMetadata meta = null;
if (i != null && i.hasNext()) {
r = i.next();
r.setInput(iis);
r.read(0);
meta = r.getImageMetadata(0);
}

if (meta != null) {
double mm2inch = 25.4;
Expand Down Expand Up @@ -873,7 +876,7 @@ public void setImageSize(IStyle style) {
this.width = this.widthMetricPt;
}
}
// auto scaling of percentage if one percentage is set and the image size is unset
// auto scaling of percentage if one percentage is set and the image size is unset
if (percentageHeight != 1.0 && percentageWidth == 1.0 && pxBackgroundWidth == 0) {
percentageWidth = percentageHeight;
} else if (percentageWidth != 1.0 && percentageHeight == 1.0 && pxBackgroundHeight == 0) {
Expand Down

0 comments on commit d4fdf93

Please sign in to comment.