[Android] LibVLC: ensure that array is not null

Thomas Guillem git at videolan.org
Thu Feb 23 10:06:15 CET 2017


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 23 10:00:47 2017 +0100| [1b1a503babc07fe7728abb9d7ef0df1dce079a6e] | committer: Thomas Guillem

LibVLC: ensure that array is not null

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

 libvlc/src/org/videolan/libvlc/LibVLC.java | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index ea3a5ad..6d158b1 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -46,23 +46,21 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
     public LibVLC(Context context, ArrayList<String> options) {
         loadLibraries();
 
+        if (options == null)
+            options = new ArrayList<String>();
         boolean setAout = true, setChroma = true;
         // check if aout/vout options are already set
-        if (options != null) {
-            for (String option : options) {
-                if (option.startsWith("--aout="))
-                    setAout = false;
-                if (option.startsWith("--android-display-chroma"))
-                    setChroma = false;
-                if (!setAout && !setChroma)
-                    break;
-            }
+        for (String option : options) {
+            if (option.startsWith("--aout="))
+                setAout = false;
+            if (option.startsWith("--android-display-chroma"))
+                setChroma = false;
+            if (!setAout && !setChroma)
+                break;
         }
 
         // set aout/vout options if they are not set
         if (setAout || setChroma) {
-            if (options == null)
-                options = new ArrayList<String>();
             if (setAout) {
                 final HWDecoderUtil.AudioOutput hwAout = HWDecoderUtil.getAudioOutputFromDevice();
                 if (hwAout == HWDecoderUtil.AudioOutput.OPENSLES)



More information about the Android mailing list