Skip to content
Snippets Groups Projects
Commit c7ae87fc authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Prevent some NPEs

parent 530214a9
No related branches found
No related tags found
No related merge requests found
......@@ -219,7 +219,7 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
}
private val showInternalStorage = AndroidDevices.showInternalStorage()
suspend fun updateBrowsers() {
private suspend fun updateBrowsers() {
val list = mutableListOf<MediaLibraryItem>()
val directories = DirectoryRepository.getInstance(requireContext()).getMediaDirectoriesList(requireContext().applicationContext).toMutableList()
if (!showInternalStorage && !directories.isEmpty()) directories.removeAt(0)
......@@ -227,10 +227,11 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
if (directory.location.scanAllowed()) list.add(directory)
}
val ctx = context ?: return
if (ExternalMonitor.isLan) {
list.add(DummyItem(HEADER_NETWORK, getString(R.string.network_browsing), null))
list.add(DummyItem(HEADER_STREAM, getString(R.string.open_mrl), null))
list.add(DummyItem(HEADER_SERVER, getString(R.string.server_add_title), null))
list.add(DummyItem(HEADER_NETWORK, ctx.getString(R.string.network_browsing), null))
list.add(DummyItem(HEADER_STREAM, ctx.getString(R.string.open_mrl), null))
list.add(DummyItem(HEADER_SERVER, ctx.getString(R.string.server_add_title), null))
updatedFavoritList.forEach{
it.description = it.uri.scheme
......
......@@ -413,6 +413,7 @@ object MediaUtils : CoroutineScope {
}
} catch (ignored: UnsupportedOperationException) {
} catch (ignored: IllegalArgumentException) {
} catch (ignored: NullPointerException) {
} catch (ignored: SecurityException) {}
fun deletePlaylist(playlist: Playlist) = launch(Dispatchers.IO) { playlist.delete() }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment