Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProNonCombatMoveAi#visit:2415 - java.lang.NullPointerException #11655

Closed
tripleabuilderbot opened this issue May 29, 2023 · 2 comments · Fixed by #11738
Closed

ProNonCombatMoveAi#visit:2415 - java.lang.NullPointerException #11655

tripleabuilderbot opened this issue May 29, 2023 · 2 comments · Fixed by #11738
Assignees
Labels
2.6 Error Report Issue reported via the in-game error reporter Regression A problem introduced in pre-release and not present in latest release

Comments

@tripleabuilderbot
Copy link
Contributor

Map

another_world

TripleA Version

2.6.14364

Java Version

11.0.9.1

Operating System

Windows 10

Stack Trace

Exception: java.lang.NullPointerException 
java.lang.Exception
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi$1.visit(ProNonCombatMoveAi.java:2415)
	at games.strategy.engine.data.util.BreadthFirstSearch.checkNextTerritory(BreadthFirstSearch.java:88)
	at games.strategy.engine.data.util.BreadthFirstSearch.traverse(BreadthFirstSearch.java:71)
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi.findDestinationOrSafeTerritoryOnTheWay(ProNonCombatMoveAi.java:2407)
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi.moveConsumablesToFactories(ProNonCombatMoveAi.java:2367)
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi.moveInfraUnits(ProNonCombatMoveAi.java:2256)
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi.doNonCombatMove(ProNonCombatMoveAi.java:184)
	at games.strategy.triplea.ai.pro.ProNonCombatMoveAi.simulateNonCombatMove(ProNonCombatMoveAi.java:77)
	at games.strategy.triplea.ai.pro.AbstractProAi.purchase(AbstractProAi.java:215)
	at games.strategy.triplea.ai.AbstractAi.start(AbstractAi.java:508)
	at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:593)
	at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:450)
	at games.strategy.engine.framework.ServerGame.runNextStep(ServerGame.java:345)
	at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:312)
	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:834)


@tripleabuilderbot tripleabuilderbot added 2.6 Error Report Issue reported via the in-game error reporter labels May 29, 2023
@asvitkine asvitkine self-assigned this Jul 4, 2023
@asvitkine
Copy link
Contributor

NPE is on this line:

                if (moveMap.get(r.getEnd()).isCanHold() && validateMove.test(r)) {

I assume moveMap.get() is returning null? We could add a simple guard, but there must be a deeper underlying issue...

@asvitkine asvitkine added the Regression A problem introduced in pre-release and not present in latest release label Jul 6, 2023
@asvitkine
Copy link
Contributor

asvitkine commented Jul 6, 2023

moveMap comes from territoryManager.getDefendOptions().getTerritoryMap();

I guess an issue could be that we're using the wrong moveMap here - i.e. if defendOptions is only populated with territories that can be defended by the AI's units, whereas here we're choosing a path for infra (non-defensive) units.

I will try to see if I can make a repro for this with edit mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.6 Error Report Issue reported via the in-game error reporter Regression A problem introduced in pre-release and not present in latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants