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,8 +115,15 @@ class ImportHelper(
val playlistFile = ObjectMapper().readValue(uri.readText(), ImportPlaylistFile::class.java)
CoroutineScope(Dispatchers.IO).launch {
playlistFile.playlists?.let {
PlaylistsHelper.importPlaylists(activity, it)
try {
playlistFile.playlists?.let {
PlaylistsHelper.importPlaylists(activity, it)
}
} catch (e: Exception) {
Log.e(TAG(), e.toString())
e.localizedMessage?.let {
activity.applicationContext.toastFromMainThread(it)
}
}
}