From 9ecaf1fa07288c98cf4ba2e6afb719021291c6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kutay=20Karakam=C4=B1s=CC=A7?= Date: Fri, 1 Sep 2023 15:54:19 +0300 Subject: [PATCH] duration Nan issue fix If audio url has authentication, sometimes duration came as Nan. Integer(NaN) causes crash. --- Sources/Protocols/MessagesDisplayDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Protocols/MessagesDisplayDelegate.swift b/Sources/Protocols/MessagesDisplayDelegate.swift index b012d785..2548fde8 100644 --- a/Sources/Protocols/MessagesDisplayDelegate.swift +++ b/Sources/Protocols/MessagesDisplayDelegate.swift @@ -385,7 +385,7 @@ extension MessagesDisplayDelegate { returnValue = String(format: "0:%.02d", Int(duration.rounded(.up))) } else if duration < 3600 { returnValue = String(format: "%.02d:%.02d", Int(duration / 60), Int(duration) % 60) - } else { + } else if duration.isFinite { let hours = Int(duration / 3600) let remainingMinutesInSeconds = Int(duration) - hours * 3600 returnValue = String(