triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.35k stars 399 forks source link

ProPurchaseValidationUtils#canUnitsBePlaced:84 - java.lang.NullPointerException #12966

Closed tripleabuilderbot closed 2 weeks ago

tripleabuilderbot commented 3 weeks ago

User Description

As suggessted here (https://github.com/triplea-game/triplea/issues/12952) I installed version 2.7

same error occurs

Map

world_war_i_1914_improved / World War I 1914 Improved

TripleA Version

2.7.14871

Java Version

11.0.19

Operating System

Mac OS X

Heap Size

8192M

Stack Trace

Exception: java.lang.NullPointerException 
java.lang.Exception
    at games.strategy.triplea.ai.pro.util.ProPurchaseValidationUtils.canUnitsBePlaced(ProPurchaseValidationUtils.java:84)
    at games.strategy.triplea.ai.pro.util.ProPurchaseValidationUtils.lambda$findPurchaseOptionsForTerritory$0(ProPurchaseValidationUtils.java:58)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at games.strategy.triplea.ai.pro.util.ProPurchaseValidationUtils.findPurchaseOptionsForTerritory(ProPurchaseValidationUtils.java:61)
    at games.strategy.triplea.ai.pro.util.ProPurchaseValidationUtils.findPurchaseOptionsForTerritory(ProPurchaseValidationUtils.java:44)
    at games.strategy.triplea.ai.pro.util.ProPurchaseUtils.findMaxPurchaseDefenders(ProPurchaseUtils.java:96)
    at games.strategy.triplea.ai.pro.ProCombatMoveAi.removeAttacksUntilCapitalCanBeHeld(ProCombatMoveAi.java:1789)
    at games.strategy.triplea.ai.pro.ProCombatMoveAi.doCombatMove(ProCombatMoveAi.java:128)
    at games.strategy.triplea.ai.pro.AbstractProAi.purchase(AbstractProAi.java:219)
    at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:509)
    at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:614)
    at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:463)
    at games.strategy.engine.framework.ServerGame.runNextStep(ServerGame.java:350)
    at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:317)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:92)
    at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
    at java.base/java.lang.Thread.run(Thread.java:829)
beelee1 commented 3 weeks ago

hmm looks as if the AI doesn't like 1914. Does it do it on any other maps ? It may be map specific, which would imply a xml issue

asvitkine commented 2 weeks ago

https://github.com/triplea-game/triplea/blob/696391cc1fd68eb7a8185f09e58f68e07d7362ce/game-app/game-core/src/main/java/games/strategy/triplea/ai/pro/util/ProPurchaseValidationUtils.java#L84 is the line of code that crashes.

So the place delegate is not found?

asvitkine commented 2 weeks ago

Is there a link to the world_war_i_1914_improved map? I only see world_war_i_1914 on github: https://github.com/triplea-maps/world_war_i_1914/blob/master/games/world_war_i_1914.xml

asvitkine commented 2 weeks ago

I guess we discussed this here already: https://github.com/triplea-game/triplea/issues/12872 Let me close this one.