Skip to content

Commit

Permalink
Validate requested window size
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Dec 28, 2023
1 parent 1287992 commit d9cb291
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ammonite/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ namespace ammonite {
yPos += frameTop;
}

if (width < 0 || height < 0) {
ammonite::utils::warning << "Window dimensions can't be negative (requested " \
<< width << " x " << height << ")" << std::endl;
return;
}

//Update the geometry of the window
glfwSetWindowPos(windowPtr, xPos, yPos);
glfwSetWindowSize(windowPtr, width, height);
Expand Down

0 comments on commit d9cb291

Please sign in to comment.