Added an error message when SDL_GetWindowFromID() fails

This commit is contained in:
Sam Lantinga
2024-08-02 18:43:24 -07:00
parent e058aa6d65
commit 2c1d40a9eb
+4
View File
@@ -2649,13 +2649,17 @@ SDL_Window *SDL_GetWindowFromID(SDL_WindowID id)
SDL_Window *window; SDL_Window *window;
if (!_this) { if (!_this) {
SDL_UninitializedVideo();
return NULL; return NULL;
} }
if (id) {
for (window = _this->windows; window; window = window->next) { for (window = _this->windows; window; window = window->next) {
if (window->id == id) { if (window->id == id) {
return window; return window;
} }
} }
}
SDL_SetError("Invalid window ID"); \
return NULL; return NULL;
} }