fix crash when importing playlists of wrong format

This commit is contained in:
Bnyro 2022-12-08 17:51:22 +01:00
parent ff61ae4c7d
commit f7e9df69ba

View File

@ -115,9 +115,16 @@ class ImportHelper(
val playlistFile = ObjectMapper().readValue(uri.readText(), ImportPlaylistFile::class.java)
CoroutineScope(Dispatchers.IO).launch {
try {
playlistFile.playlists?.let {
PlaylistsHelper.importPlaylists(activity, it)
}
} catch (e: Exception) {
Log.e(TAG(), e.toString())
e.localizedMessage?.let {
activity.applicationContext.toastFromMainThread(it)
}
}
}
activity.toastFromMainThread(R.string.success)