averbraeck / housinggame-facilitator

Facilitator app for the housing game
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

NPE when showing house table #5

Closed averbraeck closed 11 months ago

averbraeck commented 11 months ago

Cannot invoke "nl.tudelft.simulation.housinggame.data.tables.records.PlayerroundRecord.getFinalHouseroundId()" because "playerRound" is null

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.lang.NullPointerException: Cannot invoke "nl.tudelft.simulation.housinggame.data.tables.records.PlayerroundRecord.getFinalHouseroundId()" because "playerRound" is null
    nl.tudelft.simulation.housinggame.facilitator.FacilitatorData.getHouseForPlayerRound(FacilitatorData.java:331)
    nl.tudelft.simulation.housinggame.facilitator.FacilitatorServlet.getPlayersForOwnedHouseIds(FacilitatorServlet.java:757)
    nl.tudelft.simulation.housinggame.facilitator.FacilitatorServlet.makeHouseTable(FacilitatorServlet.java:573)
averbraeck commented 11 months ago

(1) The playerround list made in SqlUtils contains null entries for players who did not (yet) play an active round, starting from round 0. A check for this null entry has been added.

(2) The house table was retrieved by an SQL statement that still included address as the sorting criterion per round, rather than the code. This has also been addressed.

Result: house table as expected.

image