[Android] Fix IllegalStateException
Nicolas Pomepuy
git at videolan.org
Wed Aug 5 14:29:59 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Aug 5 07:32:23 2020 +0200| [3836b3ec9cd7a80b132b19d36b3f94e516548f49] | committer: Nicolas Pomepuy
Fix IllegalStateException
> https://code.videolan.org/videolan/vlc-android/commit/3836b3ec9cd7a80b132b19d36b3f94e516548f49
---
.../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 6 +++++-
application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 11e4413df..393ce9951 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1762,7 +1762,11 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
if (wasPaused && BuildConfig.DEBUG)
Log.d(TAG, "Video was previously paused, resuming in paused mode")
intent.data?.let {
- val translatedPath = FileUtils.getPathFromURI(it)
+ val translatedPath = try {
+ FileUtils.getPathFromURI(it)
+ } catch (e: IllegalStateException) {
+ ""
+ }
videoUri = if (translatedPath.isNotEmpty()) translatedPath.toUri() else it
}
if (extras != null) {
diff --git a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
index 597617e07..4a9600dd4 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
@@ -96,9 +96,9 @@ object FileUtils {
cursor = AppContextProvider.appContext.contentResolver.query(contentUri, proj, null, null, null)
if (cursor == null || cursor.count == 0)
return ""
- val column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
+ val columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
cursor.moveToFirst()
- return cursor.getString(column_index)
+ return cursor.getString(columnIndex)
} catch (e: IllegalArgumentException) {
return ""
} catch (e: SecurityException) {
More information about the Android
mailing list