[Android] Fix NPE

Geoffrey Métais git at videolan.org
Wed Aug 30 15:08:47 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Aug 30 14:43:26 2017 +0200| [11d1c92bda96af0d67fc93ad182fcc49e23f2019] | committer: Geoffrey Métais

Fix NPE

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

 vlc-android/src/org/videolan/vlc/util/VLCOptions.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index ee5485cd8..2106ab452 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -202,8 +202,8 @@ public class VLCOptions {
     @MainThread
     public static MediaPlayer.Equalizer getEqualizerSetFromSettings(Context context) {
         final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
-        if (pref.contains("equalizer_enabled")) {
-            final float[] bands = Preferences.getFloatArray(pref, "equalizer_values");
+        final float[] bands = Preferences.getFloatArray(pref, "equalizer_values");
+        if (bands != null && pref.contains("equalizer_enabled")) {
             final int bandCount = MediaPlayer.Equalizer.getBandCount();
             if (bands.length != bandCount + 1)
                 return null;



More information about the Android mailing list