mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 13:50:05 -04:00
Fix potential panic (#2755)
* Fix potential panic * Update CHANGELOG.md * Use checked_div --------- Co-authored-by: Xiaopeng Li <lixiaopeng.jetspark@bytedance.com>
This commit is contained in:
committed by
Kirill Chibisov
parent
64a97c16c7
commit
d37dac8f39
@@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On macOS, fixed potential panic when getting refresh rate.
|
||||||
|
|
||||||
# 0.28.3
|
# 0.28.3
|
||||||
|
|
||||||
- Fix macOS memory leaks.
|
- Fix macOS memory leaks.
|
||||||
|
|||||||
@@ -230,7 +230,9 @@ impl MonitorHandle {
|
|||||||
return None;
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user