Fixed crash retrieving the name of some displays.

This commit is contained in:
Camilla Berglund 2013-11-07 16:20:52 +01:00
parent 97ae40496d
commit cc7f0bd532
2 changed files with 5 additions and 2 deletions

View File

@ -55,6 +55,7 @@ guide in the GLFW documentation.
- [Cocoa] Bugfix: Full screen windows were never reported as having focus
- [Cocoa] Bugfix: A superfluous I/O flag test prevented video modes from being
listed for Thunderbolt monitor
- [Cocoa] Bugfix: Retrieving the name of some external displays caused segfault
- [X11] Added setting of the `WM_CLASS` property to the initial window title
- [X11] Bugfix: Removed joystick axis value negation left over from GLFW 2
- [X11] Bugfix: The position of hidden windows was ignored by Metacity

View File

@ -49,9 +49,11 @@ static const char* getDisplayName(CGDirectDisplayID displayID)
kIODisplayOnlyPreferredName);
names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
if (!CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
(const void**) &value))
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
CFRelease(info);
return strdup("Unknown");
}