diff --git a/plugins/webp/src/com/android/tools/adtui/webp/WebpImageReaderSpi.java b/plugins/webp/src/com/android/tools/adtui/webp/WebpImageReaderSpi.java index e9ed4e8fc5c4..b2c81d678863 100644 --- a/plugins/webp/src/com/android/tools/adtui/webp/WebpImageReaderSpi.java +++ b/plugins/webp/src/com/android/tools/adtui/webp/WebpImageReaderSpi.java @@ -206,9 +206,7 @@ public final class WebpImageReaderSpi extends ImageReaderSpi { @Override public @NotNull BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { loadInfoIfNeeded(); - if (myError == 0) { - throw new IOException(UNABLE_TO_READ_WEBP_IMAGE); - } + if (myError == 0) throw new IOException(UNABLE_TO_READ_WEBP_IMAGE); assert myInputBytes != null; byte[] argb = libwebp.WebPDecodeARGB(myInputBytes, myInputBytes.length, myWidthOut, myHeightOut); @SuppressWarnings("UndesirableClassUsage") @@ -216,7 +214,7 @@ public final class WebpImageReaderSpi extends ImageReaderSpi { // Copy the bytes read above to the image's data buffer. final int[] a = ((DataBufferInt) bi.getRaster().getDataBuffer()).getData(); IntBuffer intBuf = ByteBuffer.wrap(argb).asIntBuffer(); - assert a.length == intBuf.remaining(); + if (a.length != intBuf.remaining()) throw new IOException(UNABLE_TO_READ_WEBP_IMAGE); intBuf.get(a); return bi; }