Skip to content

Commit

Permalink
fix: avoid writing window size of 0 to the config (#4619)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahela97 authored May 14, 2021
1 parent c53b41f commit 9b94536
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ public void preShutdown() {
int[] xBuffer = new int[1];
int[] yBuffer = new int[1];
GLFW.glfwGetWindowPos(window, xBuffer, yBuffer);
config.setWindowPosX(xBuffer[0]);
config.setWindowPosY(yBuffer[0]);

int[] widthBuffer = new int[1];
int[] heightBuffer = new int[1];
GLFW.glfwGetWindowSize(window, widthBuffer, heightBuffer);
config.setWindowWidth(widthBuffer[0]);
config.setWindowHeight(heightBuffer[0]);

if (widthBuffer[0]>0 && heightBuffer[0]>0 && xBuffer[0]>0 && yBuffer[0]>0) {
config.setWindowWidth(widthBuffer[0]);
config.setWindowHeight(heightBuffer[0]);
config.setWindowPosX(xBuffer[0]);
config.setWindowPosY(yBuffer[0]);
}
}
}
}
Expand Down

0 comments on commit 9b94536

Please sign in to comment.