File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
app/src/main/java/com/amaze/filemanager/utils Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ object OTGUtil {
98
98
fileFound : OnFileFound
99
99
) {
100
100
var rootUri = DocumentFile .fromTreeUri(context, rootUriString)
101
+
101
102
val parts: Array <String > = if (openMode == OpenMode .DOCUMENT_FILE ) {
102
103
path.substringAfter(rootUriString.toString())
103
104
.split(" /" , PATH_SEPARATOR_ENCODED ).toTypedArray()
@@ -110,11 +111,16 @@ object OTGUtil {
110
111
if (part == " otg:" || part == " " || part == " content:" ) continue
111
112
112
113
// iterating through the required path to find the end point
113
- rootUri = rootUri!! .findFile(part)
114
+ rootUri = rootUri?.findFile(part)
115
+ }
116
+
117
+ if (rootUri == null ) {
118
+ Log .e(TAG , " Null DocumentFile listed!" )
119
+ return
114
120
}
115
121
116
122
// we have the end point DocumentFile, list the files inside it and return
117
- for (file in rootUri!! .listFiles()) {
123
+ for (file in rootUri.listFiles()) {
118
124
if (file.exists()) {
119
125
var size: Long = 0
120
126
if (! file.isDirectory) size = file.length()
You can’t perform that action at this time.
0 commit comments