mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-28 08:43:57 +00:00
Check for null return from CGDisplayCopyAllDisplayModes()
This commit is contained in:
1 parent
0d998a1247
commit
3da99d62e5
1 file changed
+6
@@ -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));
|
||||
|
||||
Reference in new issue
Block a user