fix NPE in ImageInputStreamDecoder
Brought to you by:
christreber
public byte[] readBytes(final long pBytes, final byte[] pBuffer)
throws IOException {
byte[] lBuffer = pBuffer;
if (lBuffer == null) {
lBuffer = new byte[(int) pBytes];
} else {
if (lBuffer.length < pBytes) {
throw new IllegalArgumentException(
"Insufficient space in buffer");
}
}
*********
OLD: final int lBytesRead = _stream.read(pBuffer, 0, (int) pBytes);
FIX: final int lBytesRead = _stream.read(lBuffer, 0, (int) pBytes);
pBuffer is null when invoked i.e. by BitmapIndexed8BPP and lBuffer was allocated above
*********
if (lBytesRead != pBytes) {
throw new IOException("Tried to read " + pBytes
+ " bytes, but obtained " + lBytesRead);
}
_pos += pBytes;
return lBuffer;
}