summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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, ...);
/**
*