diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 8d5c331d..b8ddb0e2 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -28,6 +28,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; public class dbBuildingHandler extends dbHandlerBase { @@ -435,6 +436,11 @@ public class dbBuildingHandler extends dbHandlerBase { while (rs.next()) { BuildingFriends friend = new BuildingFriends(rs); + // Create map if it does not yet exist + + if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID)) + BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>()); + switch (friend.friendType) { case 7: BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);