From d4e20883d7eb29c3193aaed503599e82835dd72c Mon Sep 17 00:00:00 2001 From: Christian Grigis Date: Tue, 1 Dec 2020 16:42:18 +0100 Subject: [PATCH] Avoid division by 0 --- .../exposurenotification/ExposureNotificationServiceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt index d0c7aff7..6dbe9719 100644 --- a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt +++ b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/ExposureNotificationServiceImpl.kt @@ -280,7 +280,7 @@ class ExposureNotificationServiceImpl(private val context: Context, private val } if (todoKeyFiles.size > 0) { - val time = (System.currentTimeMillis() - start).toDouble() / 1000.0 + val time = (System.currentTimeMillis() - start).coerceAtLeast(1).toDouble() / 1000.0 Log.d(TAG, "$packageName/${params.token} processed $keys keys (${todoKeyFiles.size} files pending) in ${time}s -> ${(keys.toDouble() / time * 1000).roundToInt().toDouble() / 1000.0} keys/s") }