Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
13
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
40579537
Commit
40579537
authored
5 years ago
by
Nicolas Pomepuy
Browse files
Options
Downloads
Patches
Plain Diff
Fix NullPointerException whe deleting files
parent
0efa9402
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!215
Fixes for beta
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+15
-12
15 additions, 12 deletions
vlc-android/src/org/videolan/vlc/util/FileUtils.kt
with
15 additions
and
12 deletions
vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+
15
−
12
View file @
40579537
...
...
@@ -323,19 +323,22 @@ object FileUtils {
@WorkerThread
fun
findFile
(
uri
:
Uri
):
DocumentFile
?
{
val
storage
=
getMediaStorage
(
uri
)
val
treePref
=
Settings
.
getInstance
(
VLCApplication
.
appContext
).
getString
(
"tree_uri_"
+
storage
!!
,
null
)
?:
return
null
val
treeUri
=
Uri
.
parse
(
treePref
)
var
documentFile
=
DocumentFile
.
fromTreeUri
(
VLCApplication
.
appContext
,
treeUri
)
val
parts
=
uri
.
path
.
split
(
"/"
.
toRegex
()).
dropLastWhile
{
it
.
isEmpty
()
}.
toTypedArray
()
for
(
i
in
3
until
parts
.
size
)
{
if
(
documentFile
!=
null
)
documentFile
=
documentFile
.
findFile
(
parts
[
i
])
else
return
null
uri
.
path
?.
let
{
path
->
val
storage
=
getMediaStorage
(
uri
)
val
treePref
=
Settings
.
getInstance
(
VLCApplication
.
appContext
).
getString
(
"tree_uri_"
+
storage
!!
,
null
)
?:
return
null
val
treeUri
=
Uri
.
parse
(
treePref
)
var
documentFile
=
DocumentFile
.
fromTreeUri
(
VLCApplication
.
appContext
,
treeUri
)
val
parts
=
path
.
split
(
"/"
.
toRegex
()).
dropLastWhile
{
it
.
isEmpty
()
}.
toTypedArray
()
for
(
i
in
3
until
parts
.
size
)
{
if
(
documentFile
!=
null
)
documentFile
=
documentFile
.
findFile
(
parts
[
i
])
else
return
null
}
return
documentFile
}
return
documentFile
return
null
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment