[Android] Fix NPE with "vlc://..." uris
Geoffrey Métais
git at videolan.org
Wed Dec 16 18:37:36 CET 2015
vlc-android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 16 18:26:25 2015 +0100| [01941ae31848734e4b758cb87dbc58df54f4f666] | committer: Geoffrey Métais
Fix NPE with "vlc://..." uris
(cherry picked from commit 0ebdca44af0b78bbedf53a8ade9d8125d528577a)
> https://code.videolan.org/videolan/vlc-android/commit/01941ae31848734e4b758cb87dbc58df54f4f666
---
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 5f1766a..db37b33 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2687,17 +2687,15 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
}
} /* External application */
- else if (intent.getDataString() != null) {
- // Plain URI
- final String location = intent.getDataString();
+ else if (intent.getData() != null) {
+ mUri = intent.getData();
+
// Remove VLC prefix if needed
- if (location.startsWith("vlc://")) {
- mUri = AndroidUtil.LocationToUri(location.substring(6));
- } else {
- mUri = intent.getData();
- if (mUri.getScheme() == null)
- mUri = AndroidUtil.PathToUri(mUri.getPath());
+ if (TextUtils.equals(mUri.getScheme(), "vlc") && mUri.toString().length() > 6) {
+ mUri = Uri.parse(mUri.toString().substring(6));
}
+ if (mUri.getScheme() == null)
+ mUri = AndroidUtil.PathToUri(mUri.getPath());
} else {
Log.e(TAG, "Couldn't understand the intent");
encounteredError();
More information about the Android
mailing list