mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-07-19 14:37:32 +00:00
WIN_GetDrawableSize: avoid NULL pointer dereference
Fixes https://github.com/libsdl-org/SDL/issues/6356
This commit is contained in:
parent
a1d1946dcb
commit
4726270ead
|
@ -1408,10 +1408,16 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
|
||||||
void
|
void
|
||||||
WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h)
|
WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h)
|
||||||
{
|
{
|
||||||
const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata);
|
HWND hwnd;
|
||||||
HWND hwnd = data->hwnd;
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
|
if (!window || !(window->driverdata)) {
|
||||||
|
*w = 0;
|
||||||
|
*h = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hwnd = ((SDL_WindowData *)window->driverdata)->hwnd;
|
||||||
if (GetClientRect(hwnd, &rect)) {
|
if (GetClientRect(hwnd, &rect)) {
|
||||||
*w = rect.right;
|
*w = rect.right;
|
||||||
*h = rect.bottom;
|
*h = rect.bottom;
|
||||||
|
|
Loading…
Reference in a new issue