[Android] RemoteAcces: fix null media description crash

Duncan McNamara git at videolan.org
Thu Sep 5 09:44:46 UTC 2024


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Aug 21 13:12:16 2024 +0200| [0301f23d7518f83cea8635d8a7662a55de04b738] | committer: Nicolas Pomepuy

RemoteAcces: fix null media description crash

If for some reason the provider is stuck, the description in the
getProviderContent can be null if the underlaying
MedialibraryItem.description hasn't yet been initialized.

This can happen by triggering the smd auth dialog from the remote
access, leaving it untouched on the phone, and then from the remote
access querying any list of directories, their description is stuck as
long as the smb dialog is still opened.

Fixes #3037

> https://code.videolan.org/videolan/vlc-android/commit/0301f23d7518f83cea8635d8a7662a55de04b738
---

 .../src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
index cd8fdadbf8..c832603877 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
@@ -1427,7 +1427,7 @@ private suspend fun getProviderContent(context:Context, provider: BrowserProvide
                     context.resources.getQuantityString(org.videolan.vlc.R.plurals.mediafiles_quantity, files, files)
                 } else if (folders > 0) {
                     context.resources.getQuantityString(org.videolan.vlc.R.plurals.subfolders_quantity, folders, folders)
-                } else mediaLibraryItem.description
+                } else mediaLibraryItem.description ?: ""
             }
         } catch (e: Exception) {
             Log.e(RemoteAccessServer::class.java.simpleName, e.message, e)



More information about the Android mailing list