[Android] Fix NullPointerException
Nicolas Pomepuy
git at videolan.org
Thu Nov 5 11:38:04 CET 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 4 07:51:36 2020 +0100| [bc489c4291f22e3b5f0d0c3a67edc7dea448db80] | committer: Nicolas Pomepuy
Fix NullPointerException
> https://code.videolan.org/videolan/vlc-android/commit/bc489c4291f22e3b5f0d0c3a67edc7dea448db80
---
libvlc/src/org/videolan/libvlc/util/VLCUtil.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
index a777fd0f3..031e64635 100644
--- a/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/VLCUtil.java
@@ -25,12 +25,9 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.os.Build;
-import androidx.annotation.NonNull;
import android.util.Log;
-import org.videolan.libvlc.interfaces.ILibVLC;
-import org.videolan.libvlc.interfaces.IMedia;
-import org.videolan.libvlc.Media;
+import androidx.annotation.NonNull;
import java.io.BufferedReader;
import java.io.Closeable;
@@ -508,7 +505,8 @@ public class VLCUtil {
* Therefore, decode the characters authorized by Android Uri when creating an Uri from VLC.
*/
public static Uri UriFromMrl(String mrl) {
- final char array[] = mrl.toCharArray();
+ if (mrl == null) return null;
+ final char[] array = mrl.toCharArray();
final StringBuilder sb = new StringBuilder(array.length*2);
for (int i = 0; i < array.length; ++i) {
final char c = array[i];
More information about the Android
mailing list