Check for valid fields calling EnumDisplaySettings

This commit is contained in:
Henrik Rydgård 2023-01-05 13:07:36 +01:00
parent e37be42a6c
commit 14f45e3b44

View File

@ -289,7 +289,11 @@ static int ScreenRefreshRateHz() {
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) == 0) {
return 60; // default value
} else {
return lpDevMode.dmDisplayFrequency > 15 ? lpDevMode.dmDisplayFrequency : 60;
if (lpDevMode.dmFields & DM_DISPLAYFREQUENCY) {
return lpDevMode.dmDisplayFrequency > 15 ? lpDevMode.dmDisplayFrequency : 60;
} else {
return 60;
}
}
}