src/macosx/native/sun/awt/CGraphicsDevice.m
Print this page
@@ -66,10 +66,15 @@
CFRelease(modeString);
if (thisBpp != bpp || (int)CGDisplayModeGetHeight(cRef) != h || (int)CGDisplayModeGetWidth(cRef) != w) {
// One of the key parameters does not match
continue;
}
+
+ if (refrate == 0) { // REFRESH_RATE_UNKNOWN
+ return cRef;
+ }
+
// Refresh rate might be 0 in display mode and we ask for specific display rate
// but if we do not find exact match then 0 refresh rate might be just Ok
if (CGDisplayModeGetRefreshRate(cRef) == refrate) {
// Exact match
return cRef;
@@ -163,11 +168,14 @@
if (config != NULL) {
CFRelease(config);
}
}
}];
+ } else {
+ [JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
}
+
CFRelease(allModes);
JNF_COCOA_EXIT(env);
}
/*