Skip to content

Commit c0594bd

Browse files
committed
Issue nostra13#725: Prevent NPE log
1 parent b6e2d13 commit c0594bd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/src/com/nostra13/universalimageloader/core/decode/BaseImageDecoder.java

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class BaseImageDecoder implements ImageDecoder {
4343
protected static final String LOG_SCALE_IMAGE = "Scale subsampled image (%1$s) to %2$s (scale = %3$.5f) [%4$s]";
4444
protected static final String LOG_ROTATE_IMAGE = "Rotate image on %1$d\u00B0 [%2$s]";
4545
protected static final String LOG_FLIP_IMAGE = "Flip image horizontally [%s]";
46+
protected static final String ERROR_NO_IMAGE_STREAM = "No stream for image [%s]";
4647
protected static final String ERROR_CANT_DECODE_IMAGE = "Image can't be decoded [%s]";
4748

4849
protected final boolean loggingEnabled;
@@ -71,6 +72,10 @@ public Bitmap decode(ImageDecodingInfo decodingInfo) throws IOException {
7172
ImageFileInfo imageInfo;
7273

7374
InputStream imageStream = getImageStream(decodingInfo);
75+
if (imageStream == null) {
76+
L.e(ERROR_NO_IMAGE_STREAM, decodingInfo.getImageKey());
77+
return null;
78+
}
7479
try {
7580
imageInfo = defineImageSizeAndRotation(imageStream, decodingInfo);
7681
imageStream = resetStream(imageStream, decodingInfo);

0 commit comments

Comments
 (0)