diff --git a/CHANGELOG.md b/CHANGELOG.md index dcff48c7a..e9e6bb306 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- On macOS, fixed potential panic when getting refresh rate. + # 0.28.3 - Fix macOS memory leaks. diff --git a/src/platform_impl/macos/monitor.rs b/src/platform_impl/macos/monitor.rs index 21250241f..54a99040a 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) } }