[Android] Fix NullPointerException
Nicolas Pomepuy
git at videolan.org
Fri Nov 13 07:31:03 CET 2020
vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 4 07:51:36 2020 +0100| [1e5a83426743107d9fa2f39953f13323ee7e714e] | committer: Nicolas Pomepuy
Fix NullPointerException
(cherry picked from commit bc489c4291f22e3b5f0d0c3a67edc7dea448db80)
> https://code.videolan.org/videolan/vlc-android/commit/1e5a83426743107d9fa2f39953f13323ee7e714e
---
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