diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 0d757f75bd586..da6219fcfeb1c 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -514,6 +514,9 @@ static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz, jobject fi } SkAutoTUnref data(SkData::NewFromFD(descriptor)); + if (data.get() == NULL) { + return nullObjectReturn("NewFromFD failed in nativeDecodeFileDescriptor"); + } SkAutoTUnref stream(new SkMemoryStream(data)); /* Allow purgeable iff we own the FD, i.e., in the puregeable and