diff --git a/CHANGELOG.md b/CHANGELOG.md index 9711dde3..2240abb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased - Bump MSRV from `1.60` to `1.64`. +- On macOS, fixed potential panic when getting refresh rate. # 0.28.3 diff --git a/src/platform_impl/macos/monitor.rs b/src/platform_impl/macos/monitor.rs index 21250241..54a99040 100644 --- a/src/platform_impl/macos/monitor.rs +++ b/src/platform_impl/macos/monitor.rs @@ -230,7 +230,9 @@ impl MonitorHandle { return None; } - Some((time.time_scale as i64 / time.time_value * 1000) as u32) + (time.time_scale as i64) + .checked_div(time.time_value) + .map(|v| (v * 1000) as u32) } }