From 0a873fcad9db6867652abf3b5b30dcda97a86263 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 31 Jan 2026 21:39:52 +0100 Subject: [PATCH] Make icon loading failure non-fatal Do not close scrcpy if the content icon cannot be loaded, even when video playback is disabled. --- app/src/screen.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/app/src/screen.c b/app/src/screen.c index 6a74e4ad..1ff3e10a 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -462,28 +462,26 @@ sc_screen_init(struct sc_screen *screen, if (!SDL_SetWindowIcon(screen->window, icon)) { LOGW("Could not set window icon: %s", SDL_GetError()); } - } else if (params->video) { - // just a warning - LOGW("Could not load icon"); - } else { - // without video, the icon is used as window content, it must be present - LOGE("Could not load icon"); - goto error_destroy_texture; - } - if (!params->video) { - assert(icon); - screen->content_size.width = icon->w; - screen->content_size.height = icon->h; - ok = sc_texture_set_from_surface(&screen->tex, icon); - if (!ok) { - scrcpy_icon_destroy(icon); - goto error_destroy_texture; + if (!params->video) { + screen->content_size.width = icon->w; + screen->content_size.height = icon->h; + ok = sc_texture_set_from_surface(&screen->tex, icon); + if (!ok) { + LOGE("Could not set icon: %s", SDL_GetError()); + } } - } - if (icon) { scrcpy_icon_destroy(icon); + } else { + // not fatal + LOGE("Could not load icon"); + + if (!params->video) { + // Make sure the content size is initialized + screen->content_size.width = 256; + screen->content_size.height = 256; + } } screen->frame = av_frame_alloc();