[Android] Fix crash when an extension is installed

Nicolas Pomepuy git at videolan.org
Thu May 7 12:17:07 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May  5 07:36:49 2020 +0200| [f1234f2f18c4df8ed5ad42455dd4414df82658fc] | committer: Nicolas Pomepuy

Fix crash when an extension is installed

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

 .../src/org/videolan/vlc/gui/helpers/Navigator.kt  | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/Navigator.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/Navigator.kt
index d15a44c5e..18d1ed8c3 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/Navigator.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/Navigator.kt
@@ -272,20 +272,22 @@ class Navigator : BottomNavigationView.OnNavigationItemSelectedListener, Lifecyc
             extensionManagerService?.stopSelf()
             return
         }
-        val extensionGroup = navigationView.menu.findItem(R.id.extensions_group)
-        extensionGroup.subMenu.clear()
-        for (id in plugins.indices) {
-            val extension = plugins[id]
-            val key = "extension_" + extension.componentName().packageName
-            if (settings.contains(key)) {
-                extensionsManager.displayPlugin(activity, id, extension, settings.getBoolean(key, false))
-            } else {
-                extensionsManager.showExtensionPermissionDialog(activity, id, extension, key)
-            }
-        }
-        if (extensionGroup.subMenu.size() == 0) extensionGroup.isVisible = false
-        onPluginsLoaded()
-        navigationView.invalidate()
+       navigationView.menu.findItem(R.id.extensions_group)?.let { extensionGroup->
+           extensionGroup.subMenu.clear()
+           for (id in plugins.indices) {
+               val extension = plugins[id]
+               val key = "extension_" + extension.componentName().packageName
+               if (settings.contains(key)) {
+                   extensionsManager.displayPlugin(activity, id, extension, settings.getBoolean(key, false))
+               } else {
+                   extensionsManager.showExtensionPermissionDialog(activity, id, extension, key)
+               }
+           }
+           if (extensionGroup.subMenu.size() == 0) extensionGroup.isVisible = false
+           onPluginsLoaded()
+           navigationView.invalidate()
+       }
+
     }
 
     private fun onPluginsLoaded() {



More information about the Android mailing list