From 17ef87f3ddda9fb6bd83bb237c8793d211ccd0f5 Mon Sep 17 00:00:00 2001 From: reveler-hub Date: Fri, 25 Sep 2026 22:12:51 +1200 Subject: [PATCH] Look up the air-quality source's own API key, not the weather source's locationRequiresApiKey and the key lookup both used location.source (the weather source) instead of location.airQualitySource. Every air-quality source today happens to share a source with its weather counterpart, so this never surfaced, but it breaks - and currently crashes via !! in OpenWeatherRepository - whenever they differ and the air-quality source needs a key the weather source doesn't. --- .../data/repository/airquality/CacheResolverForAirQuality.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/repository/airquality/CacheResolverForAirQuality.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/repository/airquality/CacheResolverForAirQuality.kt index 7a363affd..f19fc1174 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/repository/airquality/CacheResolverForAirQuality.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/repository/airquality/CacheResolverForAirQuality.kt @@ -38,10 +38,10 @@ class CacheResolverForAirQuality @Inject constructor( val cache = dao.getAirQualityForLocation(location.id) val shouldReturnCache = shouldReturnAirQualityCache(cache, isManualRefresh, isForceRefresh) - val locationRequiresApiKey = location.source.requiresUserApiKey + val locationRequiresApiKey = location.airQualitySource.requiresUserApiKey val apiKey = if (locationRequiresApiKey) - apiKeysDao.getApiKeyForSource(location.source) else null + apiKeysDao.getApiKeyForSource(location.airQualitySource) else null val domain = cache.toDomain()