Fix a NPE when windowAttribs.get() = null

java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.Map.get(Object)" is null
    at org.lwjgl.glfw.GLFW.glfwGetWindowAttrib(GLFW.java:895)
This commit is contained in:
Duy Tran Khanh 2022-03-02 19:58:03 +07:00 committed by GitHub
parent dcac1c9a97
commit 1f1d542ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -892,7 +892,11 @@ public class GLFW
}
public static int glfwGetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib) {
return internalGetWindow(window).windowAttribs.get(attrib);
Object obj = internalGetWindow(window).windowAttribs.get(attrib);
if (obj == null) {
return 0;
}
return (int) obj;
}
public static void glfwSetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib, int value) {