Merge "Fix NPE in BitmapFactory when an allocation of hw bitmap failed"

This commit is contained in:
TreeHugger Robot
2017-07-06 22:38:49 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}