Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f70bba5 authored by tibbi's avatar tibbi
Browse files

correct a string substring size check

parent b2163d44
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.12.17'
        propVersionName = '3.12.18'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+5 −7
Original line number Diff line number Diff line
@@ -309,8 +309,7 @@ fun Context.getOTGItems(path: String, countHiddenItems: Boolean, getProperFileSi
        val first = files?.firstOrNull()
        if (first != null) {
            val fullPath = first.uri.toString()
            val nameStartIndex = fullPath.lastIndexOf(first.name)
            if (fullPath.length > nameStartIndex) {
            val nameStartIndex = Math.max(fullPath.lastIndexOf(first.name), 0)
            var basePath = fullPath.substring(0, nameStartIndex)
            if (basePath.endsWith("%3A")) {
                basePath = basePath.substring(0, basePath.length - 3)
@@ -318,7 +317,6 @@ fun Context.getOTGItems(path: String, countHiddenItems: Boolean, getProperFileSi
            baseConfig.OTGBasePath = basePath
        }
    }
    }

    val basePath = "${baseConfig.OTGBasePath}%3A"
    for (file in files) {