Ver código fonte

feat: safeSubList.toIndex越界问题

DoggyZhang 1 mês atrás
pai
commit
ba70b34a71

+ 1 - 1
frame/bom/build.gradle

@@ -6,7 +6,7 @@ plugins {
 ext {
     GROUP_ID = 'com.wenext.android'
     ARTIFACT_ID = 'frame-bom'
-    VERSION = '6.2.9'
+    VERSION = '6.2.10'
 }
 
 dependencies {

+ 1 - 1
frame/util/build.gradle

@@ -7,7 +7,7 @@ plugins {
 ext {
     GROUP_ID = 'com.wenext.android'
     ARTIFACT_ID = 'frame-util'
-    VERSION = '6.0.7'
+    VERSION = '6.0.8'
 }
 
 if (project.FRAME_DEBUG != "true") {

+ 3 - 0
frame/util/src/main/java/com/adealink/frame/ext/ListExt.kt

@@ -4,6 +4,9 @@ fun <T> List<T>.safeSubList(fromIndex: Int = 0, toIndex: Int = size): List<T> {
     if (isEmpty()) {
         return emptyList()
     }
+    if (toIndex < 0) {
+        return emptyList()
+    }
     val to = if (toIndex > size) {
         size
     } else {