diff options
| author | 2017-06-28 12:44:03 -0700 | |
|---|---|---|
| committer | 2017-06-28 20:09:48 +0000 | |
| commit | d67bb1ebbc5309039a4995cba2889d874fbb4394 (patch) | |
| tree | f9fb28b8ba6446bd7d2b9ee61afa9205575623f1 | |
| parent | 87cff85403bbcd8349723d2e327c2c841157da83 (diff) | |
Fix NPE in BitmapFactory when an allocation of hw bitmap failed
Test: no tests.
bug: 63044157
Change-Id: I33663c14983f2d0050521c9fea5742ae71f96c5f
| -rw-r--r-- | core/jni/android/graphics/BitmapFactory.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 5a25d5e06f07..1bc50b0c8bcc 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -579,6 +579,9 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding if (isHardware) { sk_sp<Bitmap> hardwareBitmap = Bitmap::allocateHardwareBitmap(outputBitmap); + if (!hardwareBitmap.get()) { + return nullObjectReturn("Failed to allocate a hardware bitmap"); + } return bitmap::createBitmap(env, hardwareBitmap.release(), bitmapCreateFlags, ninePatchChunk, ninePatchInsets, -1); } |