mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
fix crash when importing playlists of wrong format
This commit is contained in:
parent
ff61ae4c7d
commit
f7e9df69ba
@ -115,9 +115,16 @@ class ImportHelper(
|
|||||||
val playlistFile = ObjectMapper().readValue(uri.readText(), ImportPlaylistFile::class.java)
|
val playlistFile = ObjectMapper().readValue(uri.readText(), ImportPlaylistFile::class.java)
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
try {
|
||||||
playlistFile.playlists?.let {
|
playlistFile.playlists?.let {
|
||||||
PlaylistsHelper.importPlaylists(activity, it)
|
PlaylistsHelper.importPlaylists(activity, it)
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG(), e.toString())
|
||||||
|
e.localizedMessage?.let {
|
||||||
|
activity.applicationContext.toastFromMainThread(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.toastFromMainThread(R.string.success)
|
activity.toastFromMainThread(R.string.success)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user