Fix segfault with --no-video

Do not call SDL_RectToFRect() if geometry is NULL.

Bug introduced by 02989249f6.
This commit is contained in:
Romain Vimont
2026-01-09 19:06:08 +01:00
parent dee1fd46a6
commit fde02a7dfa

View File

@@ -389,8 +389,12 @@ sc_display_render(struct sc_display *display, const SDL_Rect *geometry,
if (orientation == SC_ORIENTATION_0) {
SDL_FRect frect;
SDL_RectToFRect(geometry, &frect);
bool ok = SDL_RenderTexture(renderer, texture, NULL, &frect);
SDL_FRect *fgeometry = NULL;
if (geometry) {
SDL_RectToFRect(geometry, &frect);
fgeometry = &frect;
}
bool ok = SDL_RenderTexture(renderer, texture, NULL, fgeometry);
if (!ok) {
LOGE("Could not render texture: %s", SDL_GetError());
return SC_DISPLAY_RESULT_ERROR;