Added error checking to getBooleanProperty

This commit is contained in:
Elias Naur 2007-03-09 14:34:27 +00:00
parent eeb711239e
commit 3c44d0c7be
1 changed files with 6 additions and 0 deletions

View File

@ -290,8 +290,14 @@ void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, i
bool getBooleanProperty(JNIEnv *env, const char* propertyName) {
jstring property = NewStringNative(env, propertyName);
if (property == NULL)
return false;
jclass org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil");
if (org_lwjgl_LWJGLUtil_class == NULL)
return false;
jmethodID getBoolean = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "getPrivilegedBoolean", "(Ljava/lang/String;)Z");
if (getBoolean == NULL)
return false;
return (*env)->CallStaticBooleanMethod(env, org_lwjgl_LWJGLUtil_class, getBoolean, property) ? true : false;
}