[Android] Prevent NPE at device init
Geoffrey Métais
git at videolan.org
Mon Oct 2 10:25:30 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Oct 2 10:20:50 2017 +0200| [ceb673691a72e642efe01d060fe1af37ace99bd0] | committer: Geoffrey Métais
Prevent NPE at device init
> https://code.videolan.org/videolan/vlc-android/commit/ceb673691a72e642efe01d060fe1af37ace99bd0
---
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index 247b805d7..fcc0a984d 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -98,7 +98,7 @@ public class AndroidDevices {
devicesWithoutNavBar.add("HTC One XL");
hasNavBar = AndroidUtil.isICSOrLater && !devicesWithoutNavBar.contains(android.os.Build.MODEL);
final Context ctx = VLCApplication.getAppContext();
- final PackageManager pm = ctx.getPackageManager();
+ final PackageManager pm = ctx != null ? ctx.getPackageManager() : null;
hasTsp = pm == null || pm.hasSystemFeature("android.hardware.touchscreen");
isAndroidTv = pm != null && pm.hasSystemFeature("android.software.leanback");
isChromeBook = pm != null && pm.hasSystemFeature("org.chromium.arc.device_management");
More information about the Android
mailing list