diff options
author | 2020-03-24 19:14:27 +0100 | |
---|---|---|
committer | 2020-03-24 19:14:27 +0100 | |
commit | 763f64b653e69b46715dcd8f7918ed769639098c (patch) | |
tree | 256c70a218b40e3cb5d61f8c7b33aaf31bde0346 /native | |
parent | e77fa175aa0eaf62be4ebafbd8e0dbc5df18f006 (diff) | |
download | iced-763f64b653e69b46715dcd8f7918ed769639098c.tar.gz iced-763f64b653e69b46715dcd8f7918ed769639098c.tar.bz2 iced-763f64b653e69b46715dcd8f7918ed769639098c.zip |
Avoid panic in `Click::is_consecutive`
Diffstat (limited to 'native')
-rw-r--r-- | native/src/input/mouse/click.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/native/src/input/mouse/click.rs b/native/src/input/mouse/click.rs index 60ae056b..d27bc67e 100644 --- a/native/src/input/mouse/click.rs +++ b/native/src/input/mouse/click.rs @@ -68,6 +68,9 @@ impl Click { fn is_consecutive(&self, new_position: Point, time: Instant) -> bool { self.position == new_position - && time.duration_since(self.time).as_millis() <= 300 + && time + .checked_duration_since(self.time) + .map(|duration| duration.as_millis() <= 300) + .unwrap_or(false) } } |