Skip to content

Commit 3acca4a

Browse files
committed
Issue nostra13#1026 - Check markSupported()
1 parent a91f2f3 commit 3acca4a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo
174174
}
175175

176176
protected InputStream resetStream(InputStream imageStream, ImageDecodingInfo decodingInfo) throws IOException {
177-
try {
178-
imageStream.reset();
179-
} catch (IOException e) {
180-
IoUtils.closeSilently(imageStream);
181-
imageStream = getImageStream(decodingInfo);
177+
if (imageStream.markSupported()) {
178+
try {
179+
imageStream.reset();
180+
return imageStream;
181+
} catch (IOException ignored) {
182+
}
182183
}
183-
return imageStream;
184+
IoUtils.closeSilently(imageStream);
185+
return getImageStream(decodingInfo);
184186
}
185187

186188
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo,
@@ -247,4 +249,4 @@ protected ImageFileInfo(ImageSize imageSize, ExifInfo exif) {
247249
this.exif = exif;
248250
}
249251
}
250-
}
252+
}

0 commit comments

Comments
 (0)