MapScreen: avoid updating chargers twice, which can lead to crashes

due to template update limit
This commit is contained in:
johan12345
2022-09-11 18:49:28 +02:00
parent 8e622c881d
commit 4da2a273c7

View File

@@ -332,7 +332,7 @@ class MapScreen(ctx: CarContext, val session: EVMapSession) :
zoom = 16f,
filters
).awaitFinished()
chargers = response.data?.filterIsInstance(ChargeLocation::class.java)
var chargers = response.data?.filterIsInstance(ChargeLocation::class.java)
chargers?.let {
if (it.size < maxRows) {
// try again with larger radius
@@ -346,6 +346,7 @@ class MapScreen(ctx: CarContext, val session: EVMapSession) :
response.data?.filterIsInstance(ChargeLocation::class.java)
}
}
this@MapScreen.chargers = chargers
}
updateCoroutine = null