Skip glfwSetWindowAttrib if MC version < 1.13

For some reason, calling to JNI functions resulted in `null pointer deference`, despite having assert() that was not triggered. This is a workaround only to skip calling.
This commit is contained in:
Duy Tran Khanh 2022-07-21 17:02:21 +07:00 committed by GitHub
parent c47f14d3bf
commit 34736cb702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -416,8 +416,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_GLFW_nglfwSetShowingWindow(JNIEnv* en
}
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetWindowAttrib(JNIEnv* env, jclass clazz, jint attrib, jint value) {
if (!showingWindow) {
return; // nothing to do yet
if (!showingWindow || !isUseStackQueueCall) {
// If the window is not shown, there is nothing to do yet.
// For Minecraft < 1.13, calling to JNI functions here crashes the JVM for some reason, therefore it is skipped for now.
return;
}
jclass glfwClazz = (*runtimeJNIEnvPtr_JRE)->FindClass(runtimeJNIEnvPtr_JRE, "org/lwjgl/glfw/GLFW");