[Android] Prevent NPE with USBManager

Geoffrey Métais git at videolan.org
Wed Oct 31 17:57:19 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Oct 31 15:25:30 2018 +0100| [c341c6ca344e51752c68b3b96cb59619f9b4cde6] | committer: Geoffrey Métais

Prevent NPE with USBManager

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

 vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 440c4dfa0..ac1b398d4 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -106,7 +106,7 @@ public class ExternalMonitor extends BroadcastReceiver implements LifecycleObser
             });
         }
         final UsbManager usbManager = (UsbManager) ctx.getSystemService(Context.USB_SERVICE);
-        devices.add(new ArrayList<>(usbManager.getDeviceList().values()));
+        if (usbManager != null) devices.add(new ArrayList<>(usbManager.getDeviceList().values()));
     }
 
     @OnLifecycleEvent(Lifecycle.Event.ON_STOP)



More information about the Android mailing list