aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-08-23 11:14:20 +0200
committerGitHub <noreply@github.com>2024-08-23 11:14:20 +0200
commit49a7b34b2dba63ac18dc309a5d157dba07ab4133 (patch)
tree5027849b2b17673c617b14736a0cb049c1725346 /src/main/java/at/hannibal2
parent67060aeab991ebb18c3bba19adfa66c09e1acdcd (diff)
downloadskyhanni-49a7b34b2dba63ac18dc309a5d157dba07ab4133.tar.gz
skyhanni-49a7b34b2dba63ac18dc309a5d157dba07ab4133.tar.bz2
skyhanni-49a7b34b2dba63ac18dc309a5d157dba07ab4133.zip
Fix: MayorAPI not working without Ministers (#2389)
Co-authored-by: Luna <luna@alexia.lol>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/MayorJson.kt4
2 files changed, 4 insertions, 2 deletions
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<MayorPerk>,
- @Expose val minister: Minister,
+ // Ministers won't exist,
+ // when the current mayor is a special mayor
+ @Expose val minister: Minister?,
@Expose val election: MayorElection,
)