fixed launch crash on API < 24

This commit is contained in:
Thibault Deckers 2024-07-18 23:54:00 +02:00
parent b4c46ae9b2
commit 685d5c6944

View file

@ -27,7 +27,9 @@ class MediaStoreStreamHandler(private val context: Context, arguments: Any?) : E
if (arguments is Map<*, *>) { if (arguments is Map<*, *>) {
knownEntries = (arguments["knownEntries"] as? Map<*, *>?)?.map { (it.key as Number?)?.toLong() to it.value as Int? }?.toMap() knownEntries = (arguments["knownEntries"] as? Map<*, *>?)?.map { (it.key as Number?)?.toLong() to it.value as Int? }?.toMap()
directory = arguments["directory"] as String? directory = arguments["directory"] as String?
safe = arguments.getOrDefault("safe", false) as Boolean // do not use kotlin.collections `getOrDefault` as it crashes on API <24
// and there is no warning from Android Studio
safe = arguments["safe"] as Boolean? ?: false
} }
} }