fixed nullPointer

This commit is contained in:
Yvonne Schmidt 2024-12-01 00:14:04 +01:00
parent 488ae154cf
commit b89d40b39f

View File

@ -95,8 +95,14 @@ public class PropertyOverviewMenu extends Dialog {
// Fetch the current player
Player currentPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
// Iterate through the player's properties
for (PropertyField property : currentPlayer.getPropertyFields()) {
// Fetch the player's properties using their indices
List<PropertyField> fields = new ArrayList<>();
for (Integer i : currentPlayer.getProperties()) {
fields.add((PropertyField) app.getGameLogic().getBoardManager().getFieldAtIndex(i));
}
// Iterate through the fetched properties
for (PropertyField property : fields) {
if (property instanceof BuildingProperty) {
BuildingProperty building = (BuildingProperty) property;
cards.add(createBuildingCard(building));