From 49a7b34b2dba63ac18dc309a5d157dba07ab4133 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:14:20 +0200 Subject: Fix: MayorAPI not working without Ministers (#2389) Co-authored-by: Luna --- src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt | 2 +- .../java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt index 555fdb7f8..af60519f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt @@ -218,7 +218,7 @@ object MayorAPI { val currentMayorName = data.mayor.name if (lastMayor?.name != currentMayorName) { currentMayor = setAssumeMayorJson(currentMayorName, data.mayor.perks) - currentMinister = setAssumeMayorJson(data.mayor.minister.name, listOf(data.mayor.minister.perk)) + currentMinister = data.mayor.minister?.let { setAssumeMayorJson(it.name, listOf(it.perk)) } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt index 912a6f8c6..272ed5591 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt @@ -11,7 +11,9 @@ data class MayorInfo( @Expose val key: String, @Expose val name: String, @Expose val perks: List, - @Expose val minister: Minister, + // Ministers won't exist, + // when the current mayor is a special mayor + @Expose val minister: Minister?, @Expose val election: MayorElection, ) -- cgit