summaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-06 10:16:00 +0100
committerSven Gothel <[email protected]>2019-12-06 10:16:00 +0100
commitabde7e96c8ea8f36b48e99ed62029bf0e178a8fa (patch)
treebc370046cb03c7453cb56c26e4cb6023e917e3f0 /src/newt/native
parenta8c2de110a2254af137a3d99007cc77e3ecd8078 (diff)
Bug 1412: Fix commit a8c2de110a2254af137a3d99007cc77e3ecd8078
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/NewtCommon.c13
-rw-r--r--src/newt/native/NewtCommon.h4
2 files changed, 11 insertions, 6 deletions
diff --git a/src/newt/native/NewtCommon.c b/src/newt/native/NewtCommon.c
index 313b1b9fe..b13190103 100644
--- a/src/newt/native/NewtCommon.c
+++ b/src/newt/native/NewtCommon.c
@@ -98,15 +98,18 @@ void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...)
}
}
-void NewtCommon_ExceptionCheck0(JNIEnv *env)
+jboolean NewtCommon_ExceptionCheck0(JNIEnv *env)
{
if( (*env)->ExceptionCheck(env) ) {
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
+ return JNI_TRUE;
+ } else {
+ return JNI_FALSE;
}
}
-void NewtCommon_ExceptionCheck1_throwNewRuntimeException(JNIEnv *env, const char* msg, ...)
+jboolean NewtCommon_ExceptionCheck1_throwNewRuntimeException(JNIEnv *env, const char* msg, ...)
{
va_list ap;
@@ -116,14 +119,16 @@ void NewtCommon_ExceptionCheck1_throwNewRuntimeException(JNIEnv *env, const char
va_start(ap, msg);
NewtCommon_throwNewRuntimeExceptionVA(env, msg, ap);
va_end(ap);
+ return JNI_TRUE;
+ } else {
+ return JNI_FALSE;
}
}
const char * NewtCommon_GetStaticStringMethod(JNIEnv *jniEnv, jclass clazz, jmethodID jGetStrID, char *dest, int destSize, const char *altText) {
if(NULL != jniEnv && NULL != clazz && NULL != jGetStrID) {
jstring jstr = (jstring) (*jniEnv)->CallStaticObjectMethod(jniEnv, clazz, jGetStrID);
- NewtCommon_ExceptionCheck0(env);
- if(NULL != jstr) {
+ if( !NewtCommon_ExceptionCheck0(jniEnv) && NULL != jstr) {
const char * str = (*jniEnv)->GetStringUTFChars(jniEnv, jstr, NULL);
if( NULL != str) {
strncpy(dest, str, destSize-1);
diff --git a/src/newt/native/NewtCommon.h b/src/newt/native/NewtCommon.h
index 99f1440d3..07f3f69d7 100644
--- a/src/newt/native/NewtCommon.h
+++ b/src/newt/native/NewtCommon.h
@@ -39,8 +39,8 @@ jchar* NewtCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str);
void NewtCommon_FatalError(JNIEnv *env, const char* msg, ...);
void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...);
-void NewtCommon_ExceptionCheck0(JNIEnv *env);
-void NewtCommon_ExceptionCheck1_throwNewRuntimeException(JNIEnv *env, const char* msg, ...);
+jboolean NewtCommon_ExceptionCheck0(JNIEnv *env);
+jboolean NewtCommon_ExceptionCheck1_throwNewRuntimeException(JNIEnv *env, const char* msg, ...);
/**
*