diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteStrategy.kt b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteStrategy.kt index da1b089fd5..a47263cc02 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteStrategy.kt +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteStrategy.kt @@ -40,6 +40,7 @@ class ColorfulStrategy(private val colors: List = emptyList(), var isLightO object RouteStrategy { + @Volatile private var isEnable = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) private var strategy: Strategy? = null @@ -65,6 +66,9 @@ object RouteStrategy { } fun start() { + if (sorted.isEmpty()) { + fill() + } strategy = null index = 0 startColor = Int.MAX_VALUE @@ -89,10 +93,7 @@ object RouteStrategy { return } if (sorted.isEmpty()) { - fill() - } - if (sorted.isEmpty()) { - throw AssertionError("sorted map must not be null.") + return } if (acc < 0) { hasLessThan0 = true @@ -122,6 +123,9 @@ object RouteStrategy { } fun remove(acc: Double): List { + if (!isEnable) { + return emptyList() + } if (sorted.isEmpty()) { throw AssertionError("sorted map must not be null.") }