From 41b5cfa9b1bd3820f7c5ce451ba65a95a09d8d8f Mon Sep 17 00:00:00 2001 From: vegeta1k95 <32207817+vegeta1k95@users.noreply.github.com> Date: Fri, 30 Dec 2022 13:30:02 +0100 Subject: [PATCH] Fixed crash when policy prerequisite is a branch (#8273) Co-authored-by: tunerzinc@gmail.com --- .../ui/pickerscreens/PolicyPickerScreen.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt index 0ef6c0cd80..aba9874961 100644 --- a/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt +++ b/core/src/com/unciv/ui/pickerscreens/PolicyPickerScreen.kt @@ -446,13 +446,17 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo continue val prereqButton = policyNameToButton[prereqName] - drawLine(group, - // Top center - policyButton.x+policyButton.width/2, - policyButton.y+policyButton.height, - // Bottom center - prereqButton!!.x + prereqButton.width/2, - prereqButton.y) + if (prereqButton != null) { + drawLine( + group, + // Top center + policyButton.x + policyButton.width / 2, + policyButton.y + policyButton.height, + // Bottom center + prereqButton.x + prereqButton.width / 2, + prereqButton.y + ) + } } }