Android Auto: fix crash when charger has no photo

This commit is contained in:
johan12345
2021-04-12 21:21:05 +02:00
parent a80fcebe94
commit 1191ac732b

View File

@@ -615,7 +615,7 @@ class ChargerDetailScreen(ctx: CarContext, val chargerSparse: ChargeLocation) :
val response = api.getChargepointDetail(chargerSparse.id)
charger = response.body()?.chargelocations?.get(0) as ChargeLocation
val photo = charger?.photos?.get(0)
val photo = charger?.photos?.firstOrNull()
photo?.let {
val size = (carContext.resources.displayMetrics.density * 64).roundToInt()
val url = "https://api.goingelectric.de/chargepoints/photo/?key=${apikey}" +