summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Leon Scroggins <scroggo@google.com> 2019-10-10 13:28:09 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-10-10 13:28:09 +0000
commita3b702fa84b258f4bfa456223c2e02aca76de01b (patch)
treec0c408e31d30ebf3b0905acf0acdb29d63c7004b
parentaba57d6a0a272851602bbc2687bedfab0372aaf4 (diff)
parent3d7ae4efffcf3c4cbe17131a76d3020107d051fb (diff)
Merge "ImageDecoder: throw FileNotFoundException on null"
-rw-r--r--graphics/java/android/graphics/ImageDecoder.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/ImageDecoder.java b/graphics/java/android/graphics/ImageDecoder.java
index 150a941c061e..6619dba159c2 100644
--- a/graphics/java/android/graphics/ImageDecoder.java
+++ b/graphics/java/android/graphics/ImageDecoder.java
@@ -286,6 +286,9 @@ public final class ImageDecoder implements AutoCloseable {
return createFromStream(is, true, preferAnimation, this);
}
+ if (assetFd == null) {
+ throw new FileNotFoundException(mUri.toString());
+ }
return createFromAssetFileDescriptor(assetFd, preferAnimation, this);
}
}
@@ -341,6 +344,9 @@ public final class ImageDecoder implements AutoCloseable {
@NonNull
private static ImageDecoder createFromAssetFileDescriptor(@NonNull AssetFileDescriptor assetFd,
boolean preferAnimation, Source source) throws IOException {
+ if (assetFd == null) {
+ throw new FileNotFoundException();
+ }
final FileDescriptor fd = assetFd.getFileDescriptor();
final long offset = assetFd.getStartOffset();