Fix crash if pixels are null.
This commit is contained in:
parent
d3b0559b72
commit
cc6c724ee8
1 changed files with 4 additions and 1 deletions
|
@ -29,7 +29,10 @@ jobject nativeDecodeBitmap(JNIEnv *env, jobject, jbyteArray data) {
|
|||
int height;
|
||||
|
||||
uint8_t *pixels = WebPDecodeBGRA(buffer, bufferLength, &width, &height);
|
||||
jobject jbitmap = createBitmap(env, width, height, pixels);
|
||||
jobject jbitmap = nullptr;
|
||||
if (pixels != nullptr) {
|
||||
jbitmap = createBitmap(env, width, height, pixels);
|
||||
}
|
||||
|
||||
WebPFree(pixels);
|
||||
env->ReleaseByteArrayElements(data, javaBytes, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue