Fix for null pointer in embassy trade (#13707)

* G&K feature - Embassy

* fix spotted errors

* add icon and gameplay test

* fix invalid trade logic

* make embassies work for G&K only

* remove introduced bug

* trade evaluation and decline embassy

* update civilopedia for embassies

* cleanup

* diplomatic modifiers

* fix embassies unique

* make embassies unique global and bugfix

* fix AI can not trade with cs

* add embassies unique for mods

* mods require uniques to enable embassies

* fix mods require uniques to enable embassies

* update uniques.md

* apply reviewed changes

* apply reviewed change 2

* bugfix and cleanup

* remove obsolete import

* null pointer bugfix

* remove toList() and function rename

* fix for null pointer

* fix for null pointer 2
This commit is contained in:
metablaster 2025-07-25 12:05:12 +02:00 committed by GitHub
parent 1a04a7764a
commit 79d237e373
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,6 +114,7 @@ object DiplomacyAutomation {
* @param civInfo Civilization which initiates trade
*/
internal fun offerToEstablishEmbassy(civInfo: Civilization) {
if (civInfo.getCapital() == null) return
val civsThatWeCanEstablishEmbassyWith = civInfo.getKnownCivs().filter {
civInfo.diplomacyFunctions.canEstablishEmbassyWith(it)
&& !civInfo.getDiplomacyManager(it)!!.hasFlag(DiplomacyFlags.DeclinedEmbassy)