mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
dc_set_chat_mute_duration: avoid panic on overflow
This commit is contained in:
@@ -1286,7 +1286,9 @@ pub unsafe extern "C" fn dc_set_chat_mute_duration(
|
|||||||
let muteDuration = match duration {
|
let muteDuration = match duration {
|
||||||
0 => MuteDuration::NotMuted,
|
0 => MuteDuration::NotMuted,
|
||||||
-1 => MuteDuration::Forever,
|
-1 => MuteDuration::Forever,
|
||||||
n if n > 0 => MuteDuration::Until(SystemTime::now() + Duration::from_secs(duration as u64)),
|
n if n > 0 => SystemTime::now()
|
||||||
|
.checked_add(Duration::from_secs(duration as u64))
|
||||||
|
.map_or(MuteDuration::Forever, MuteDuration::Until),
|
||||||
_ => {
|
_ => {
|
||||||
warn!(
|
warn!(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user