Skip to content

Commit 0cd7aea

Browse files
committed
Display (macOS): don't crash with NULL pointer references
Fix #1393
1 parent 04088b5 commit 0cd7aea

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/detection/displayserver/displayserver_apple.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
150150
}
151151
#endif
152152

153-
if (display->type == FF_DISPLAY_TYPE_BUILTIN)
153+
if (display->type == FF_DISPLAY_TYPE_BUILTIN && displayInfo)
154154
display->hdrStatus = CFDictionaryContainsKey(displayInfo, CFSTR("ReferencePeakHDRLuminance"))
155155
? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
156156
#ifdef MAC_OS_X_VERSION_10_15
@@ -168,11 +168,15 @@ static void detectDisplays(FFDisplayServerResult* ds)
168168
#endif
169169

170170
display->serial = CGDisplaySerialNumber(screen);
171-
int value;
172-
if (ffCfDictGetInt(displayInfo, CFSTR(kDisplayYearOfManufacture), &value) == NULL)
173-
display->manufactureYear = (uint16_t) value;
174-
if (ffCfDictGetInt(displayInfo, CFSTR(kDisplayWeekOfManufacture), &value) == NULL)
175-
display->manufactureWeek = (uint16_t) value;
171+
172+
if (displayInfo)
173+
{
174+
int value;
175+
if (ffCfDictGetInt(displayInfo, CFSTR(kDisplayYearOfManufacture), &value) == NULL)
176+
display->manufactureYear = (uint16_t) value;
177+
if (ffCfDictGetInt(displayInfo, CFSTR(kDisplayWeekOfManufacture), &value) == NULL)
178+
display->manufactureWeek = (uint16_t) value;
179+
}
176180
}
177181
CGDisplayModeRelease(mode);
178182
}

0 commit comments

Comments
 (0)