From 3da99d62e525adc06ebf54cfc391a3735966026a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 14 Nov 2026 23:18:48 -0600 Subject: [PATCH] Check for null return from CGDisplayCopyAllDisplayModes() --- app/streaming/streamutils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/streaming/streamutils.cpp b/app/streaming/streamutils.cpp index b4050662..6c0e8222 100644 --- a/app/streaming/streamutils.cpp +++ b/app/streaming/streamutils.cpp @@ -277,6 +277,12 @@ bool StreamUtils::getNativeDesktopMode(int displayIndex, SDL_DisplayMode* mode, // native on macOS using the SDL API alone. We'll talk to CoreGraphics to // find the correct resolution and match it in our SDL list. CFArrayRef modeList = CGDisplayCopyAllDisplayModes(displayIds[displayIndex], nullptr); + if (modeList == nullptr) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "CGDisplayCopyAllDisplayModes() returned NULL for display %d", + displayIndex); + return false; + } CFIndex count = CFArrayGetCount(modeList); for (CFIndex i = 0; i < count; i++) { auto cgMode = (CGDisplayModeRef)(CFArrayGetValueAtIndex(modeList, i));