diff options
| author | 2017-07-06 22:38:49 +0000 | |
|---|---|---|
| committer | 2017-07-06 22:38:49 +0000 | |
| commit | 0b513504e085cd270fb70ea29523d2ed6bbf15c3 (patch) | |
| tree | 6f640efaa4c80dd50392cfb89023d53833df093d | |
| parent | afcd59b4438064726790df4828efe9cc298f5451 (diff) | |
| parent | d67bb1ebbc5309039a4995cba2889d874fbb4394 (diff) | |
Merge "Fix NPE in BitmapFactory when an allocation of hw bitmap failed"
| -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); } |