mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 16:36:25 +00:00
Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit()
(cherry picked from commit d87048fd5a
)
This commit is contained in:
@@ -1105,6 +1105,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
|
||||
center.x = x + w / 2;
|
||||
center.y = y + h / 2;
|
||||
|
||||
if (_this) {
|
||||
for (i = 0; i < _this->num_displays; ++i) {
|
||||
SDL_Rect display_rect;
|
||||
SDL_GetDisplayBounds(i, &display_rect);
|
||||
@@ -1126,6 +1127,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
|
||||
closest_dist = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closest < 0) {
|
||||
SDL_SetError("Couldn't find any displays");
|
||||
|
Reference in New Issue
Block a user