Minor optimization.

This commit is contained in:
Harald Kuhr 2015-03-07 21:14:35 +01:00
parent 5fb091b992
commit 34efe84e5a

View File

@ -179,8 +179,10 @@ public abstract class ImageReaderBase extends ImageReader {
if (index < getMinIndex()) { if (index < getMinIndex()) {
throw new IndexOutOfBoundsException("index < minIndex"); throw new IndexOutOfBoundsException("index < minIndex");
} }
else if (getNumImages(false) != -1 && index >= getNumImages(false)) {
throw new IndexOutOfBoundsException("index >= numImages (" + index + " >= " + getNumImages(false) + ")"); int numImages = getNumImages(false);
if (numImages != -1 && index >= numImages) {
throw new IndexOutOfBoundsException("index >= numImages (" + index + " >= " + numImages + ")");
} }
} }