[Android] Prevent null/empty options to be passed to VLC
Geoffrey Métais
git at videolan.org
Thu May 31 16:51:07 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May 31 16:50:14 2018 +0200| [f0162e0b2afab68d086faf3eba6e927391a5d676] | committer: Geoffrey Métais
Prevent null/empty options to be passed to VLC
> https://code.videolan.org/videolan/vlc-android/commit/f0162e0b2afab68d086faf3eba6e927391a5d676
---
vlc-android/src/org/videolan/vlc/util/VLCOptions.java | 8 ++++++--
1 file changed, 6 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 2b5d69577..d882c10bb 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -26,6 +26,7 @@ import android.media.AudioManager;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.annotation.MainThread;
+import android.text.TextUtils;
import android.util.Log;
import org.videolan.libvlc.Media;
@@ -145,8 +146,11 @@ public class VLCOptions {
options.add("--sout-chromecast-conversion-quality="+pref.getString("casting_quality", "2"));
options.add("--sout-keep");
- final String customOptions[] = pref.getString("custom_libvlc_options", "").split("\\r?\\n", -1);
- if (!Util.isArrayEmpty(customOptions)) Collections.addAll(options, customOptions);
+ final String customOptions = pref.getString("custom_libvlc_options", null);
+ if (!TextUtils.isEmpty(customOptions)) {
+ final String optionsArray[] = customOptions.split("\\r?\\n", -1);
+ if (!Util.isArrayEmpty(optionsArray)) Collections.addAll(options, optionsArray);
+ }
return options;
}
More information about the Android
mailing list