Don't panic when getting refresh rate failed (#2533)
This fixes a crash on macOS when trying to get the monitor refresh rate from the disabled monitor. Co-authored-by: Jet Spark <lixiaopeng.jetspark@bytedance.com> Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
parent
94688a62f0
commit
32784af3c4
4 changed files with 13 additions and 7 deletions
|
|
@ -192,7 +192,7 @@ impl MonitorHandle {
|
|||
|
||||
#[inline]
|
||||
pub fn refresh_rate_millihertz(&self) -> Option<u32> {
|
||||
let monitor_info = get_monitor_info(self.0).unwrap();
|
||||
let monitor_info = get_monitor_info(self.0).ok()?;
|
||||
let device_name = monitor_info.szDevice.as_ptr();
|
||||
unsafe {
|
||||
let mut mode: DEVMODEW = mem::zeroed();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue