From efd576e195c09a2a8b5155791299ef8886f2ea6d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 7 Feb 2022 10:43:01 +0200 Subject: [PATCH] Don't display empty civilopedia categories in mods that don't have them --- core/src/com/unciv/ui/civilopedia/CivilopediaScreen.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/civilopedia/CivilopediaScreen.kt b/core/src/com/unciv/ui/civilopedia/CivilopediaScreen.kt index 1a09ef6dff..101eee1068 100644 --- a/core/src/com/unciv/ui/civilopedia/CivilopediaScreen.kt +++ b/core/src/com/unciv/ui/civilopedia/CivilopediaScreen.kt @@ -221,7 +221,8 @@ class CivilopediaScreen( buttonTable.defaults().pad(10f) var currentX = 10f // = padLeft - for (categoryKey in categoryToEntries.keys) { + for ((categoryKey, entries) in categoryToEntries) { + if (entries.isEmpty()) continue val icon = if (categoryKey.headerIcon.isNotEmpty()) ImageGetter.getImage(categoryKey.headerIcon) else null val button = IconTextButton(categoryKey.label, icon) button.addTooltip(categoryKey.key)