Fix a potential crash in macOS 10.7 and earlier.
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index d7fb0fd..592367a 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -392,7 +392,10 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
#endif
modes = CGDisplayCopyAllDisplayModes(data->display, dict);
- CFRelease(dict);
+
+ if (dict != NULL) {
+ CFRelease(dict);
+ }
if (modes) {
CVDisplayLinkRef link = NULL;