Add window handle checks for glfwSetWindowIcon to Win32 and X11.

This commit is contained in:
ws909 2023-03-09 16:37:59 +01:00
parent 6381d7ed20
commit 6cd800a54d
3 changed files with 17 additions and 1 deletions

View File

@ -1520,6 +1520,14 @@ void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title)
void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images)
{
HICON bigIcon = NULL, smallIcon = NULL;
if (window == NULL)
{
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
"Win32: Requires a valid window handle to set the icon. There is no application icon to set.");
return;
}
if (count)
{

View File

@ -1899,7 +1899,7 @@ void _glfwSetWindowIconWayland(_GLFWwindow* window,
int count, const GLFWimage* images)
{
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
"Wayland: The platform does not support setting the window icon");
"Wayland: The platform does not support setting the window or application icon");
}
void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos)

View File

@ -2104,6 +2104,14 @@ void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title)
void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images)
{
if (window == NULL)
{
_glfwInputError(GLFW_FEATURE_UNAVAILABLE,
"X11: Requires a valid window handle to set the icon. There is no application icon to set.");
return;
}
if (count)
{
int longCount = 0;