From c6c0a8394e459ed511540cdb2594b2858f6f6f50 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 10 Aug 2022 09:54:49 -0400 Subject: [PATCH] windows: If a display's friendly name is blank, try the generic name. Fixes #6031. --- src/video/windows/SDL_windowsmodes.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index 098b253bbc..1bba3ecd43 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/src/video/windows/SDL_windowsmodes.c @@ -271,6 +271,12 @@ WIN_GetDisplayNameVista(const WCHAR *deviceName) rc = pDisplayConfigGetDeviceInfo(&targetName.header); if (rc == ERROR_SUCCESS) { retval = WIN_StringToUTF8W(targetName.monitorFriendlyDeviceName); + /* if we got an empty string, treat it as failure so we'll fallback + to getting the generic name. */ + if (retval && (*retval == '\0')) { + SDL_free(retval); + retval = NULL; + } } break; }