summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-09-15 13:04:03 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-09-15 14:07:48 +0800
commitad1b0d94073803719c7a62910cb85b04aa26b806 (patch)
tree4ffd6cd6ea0ffa9d21c5ee43fb59791375431dc3 /platform
parent01ee5a289e1a37a45a3016a33c43ba34e9713aac (diff)
downloadmupdf-ad1b0d94073803719c7a62910cb85b04aa26b806.tar.xz
JNI: Check context in consistent way.
Also there is no need to check self pointer since JVM does not even call the JNI binding for null pointers.
Diffstat (limited to 'platform')
-rw-r--r--platform/java/mupdf_native.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c
index ae213478..c1739680 100644
--- a/platform/java/mupdf_native.c
+++ b/platform/java/mupdf_native.c
@@ -3720,7 +3720,8 @@ FUN(Document_proofNative)(JNIEnv *env, jobject self, jstring jCurrentPath, jstri
const char *printProfile = NULL;
const char *displayProfile = NULL;
- if (ctx == NULL || doc == NULL || jCurrentPath == NULL || jPrintProfile == NULL || jDisplayProfile == NULL)
+ if (!ctx) return NULL;
+ if (jCurrentPath == NULL || jPrintProfile == NULL || jDisplayProfile == NULL)
return NULL;
currentPath = (*env)->GetStringUTFChars(env, jCurrentPath, NULL);
@@ -4057,11 +4058,7 @@ FUN(Page_countSeparations)(JNIEnv *env, jobject self)
fz_page *page = from_Page(env, self);
int nSep;
- if (ctx==NULL || page==NULL)
- {
- LOGI("Page_countSeparations fail %x %x", (unsigned int)ctx, (unsigned int)page);
- return 0;
- }
+ if (!ctx) return 0;
nSep = fz_count_separations_on_page(ctx, page);
@@ -4076,11 +4073,7 @@ FUN(Page_enableSeparation)(JNIEnv *env, jobject self, int sep, jboolean enable)
fz_context *ctx = get_context(env);
fz_page *page = from_Page(env, self);
- if (ctx==NULL || page==NULL)
- {
- LOGI("Page_enableSeparation fail %x %x", (unsigned int)ctx, (unsigned int)page);
- return;
- }
+ if (!ctx) return;
fz_control_separation_on_page(ctx, page, sep, !enable);
}
@@ -4099,11 +4092,7 @@ FUN(Page_getSeparation)(JNIEnv *env, jobject self, int sep)
jclass sepClass;
jmethodID ctor;
- if (ctx==NULL || page==NULL)
- {
- LOGI("Page_getSeparation fail %x %x", (unsigned int)ctx, (unsigned int)page);
- return 0;
- }
+ if (!ctx) return NULL;
err = 0;
sepClass = get_class(&err, env, PKG"Separation");