mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-26 19:05:14 +00:00
Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit()
This commit is contained in:
parent
6926d046c0
commit
d87048fd5a
|
@ -1122,6 +1122,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
|
||||||
center.x = x + w / 2;
|
center.x = x + w / 2;
|
||||||
center.y = y + h / 2;
|
center.y = y + h / 2;
|
||||||
|
|
||||||
|
if (_this) {
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
SDL_Rect display_rect;
|
SDL_Rect display_rect;
|
||||||
SDL_GetDisplayBounds(i, &display_rect);
|
SDL_GetDisplayBounds(i, &display_rect);
|
||||||
|
@ -1143,6 +1144,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
|
||||||
closest_dist = dist;
|
closest_dist = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (closest < 0) {
|
if (closest < 0) {
|
||||||
SDL_SetError("Couldn't find any displays");
|
SDL_SetError("Couldn't find any displays");
|
||||||
|
|
Loading…
Reference in a new issue