diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-05 12:58:57 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-08 18:53:00 +0800 |
commit | 0f27e8fe136c245f5af5d6071f041dbcd1129333 (patch) | |
tree | 9e1416a1167ae9e99fa94ec3a3f33a418a6a203c /platform | |
parent | 32e97868d52ca60e525b41ade7d298441aed96f3 (diff) | |
download | mupdf-0f27e8fe136c245f5af5d6071f041dbcd1129333.tar.xz |
JNI: Handle errors from AndroidBitmap_unlockPixels().
Diffstat (limited to 'platform')
-rw-r--r-- | platform/java/mupdf_native.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index b8ee288c..8c59a41d 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -2397,8 +2397,8 @@ FUN(Image_newImageFromBitmap)(JNIEnv *env, jobject self, jobject jbitmap, jlong if (AndroidBitmap_lockPixels(env, jbitmap, &pixels) != ANDROID_BITMAP_RESULT_SUCCESS) fz_throw(ctx, FZ_ERROR_GENERIC, "bitmap lock failed in new Image"); memcpy(pixmap->samples, pixels, info.width * info.height * 4); - (void)AndroidBitmap_unlockPixels(env, jbitmap); - + if (AndroidBitmap_unlockPixels(env, jbitmap) != ANDROID_BITMAP_RESULT_SUCCESS) + fz_throw(ctx, FZ_ERROR_GENERIC, "Bitmap unlock failed in new Image"); image = fz_new_image_from_pixmap(ctx, fz_keep_pixmap(ctx, pixmap), fz_keep_image(ctx, mask)); } fz_always(ctx) |