diff --git a/src/main/java/net/rptools/maptool/client/ServerCommandClientImpl.java b/src/main/java/net/rptools/maptool/client/ServerCommandClientImpl.java index 51a6bedcb1..a2d19c261a 100644 --- a/src/main/java/net/rptools/maptool/client/ServerCommandClientImpl.java +++ b/src/main/java/net/rptools/maptool/client/ServerCommandClientImpl.java @@ -646,7 +646,7 @@ public void updateTokenProperty( @Override public void updateTokenProperty(Token token, Token.Update update) { - updateTokenProperty(token, update); + updateTokenProperty(token, update, new TokenPropertyValueDto[] {}); } @Override diff --git a/src/main/java/net/rptools/maptool/model/Campaign.java b/src/main/java/net/rptools/maptool/model/Campaign.java index a9ec4f7b5a..b51ecac669 100644 --- a/src/main/java/net/rptools/maptool/model/Campaign.java +++ b/src/main/java/net/rptools/maptool/model/Campaign.java @@ -126,6 +126,14 @@ public Campaign() { gmMacroButtonProperties = new ArrayList(); } + private Object readResolve() { + if (exportSettings == null) { + exportSettings = new HashMap<>(); + } + + return this; + } + private void checkCampaignPropertyConversion() { if (campaignProperties == null) { campaignProperties = new CampaignProperties(); diff --git a/src/main/java/net/rptools/maptool/model/LookupTable.java b/src/main/java/net/rptools/maptool/model/LookupTable.java index 0355984a72..47a58468ec 100644 --- a/src/main/java/net/rptools/maptool/model/LookupTable.java +++ b/src/main/java/net/rptools/maptool/model/LookupTable.java @@ -391,6 +391,14 @@ public LookupEntry(int min, int max, String value, MD5Key imageId) { this.imageId = imageId; } + private Object readResolve() { + if (picked == null) { + picked = false; + } + + return this; + } + public MD5Key getImageId() { return imageId; } @@ -525,7 +533,9 @@ public LookupTableDto toDto() { var dto = LookupTableDto.newBuilder(); dto.addAllEntries(entryList.stream().map(e -> e.toDto()).collect(Collectors.toList())); dto.setName(name); - dto.setDefaultRoll(defaultRoll); + if (defaultRoll != null) { + dto.setDefaultRoll(defaultRoll); + } if (tableImage != null) { dto.setTableImage(StringValue.of(tableImage.toString())); } diff --git a/src/main/java/net/rptools/maptool/model/Token.java b/src/main/java/net/rptools/maptool/model/Token.java index 2eff31e092..3e2b97c783 100644 --- a/src/main/java/net/rptools/maptool/model/Token.java +++ b/src/main/java/net/rptools/maptool/model/Token.java @@ -263,7 +263,7 @@ public enum Update { private Area vbl; private String name; - private final Set ownerList = new HashSet<>(); + private Set ownerList = new HashSet<>(); private int ownerType; @@ -323,7 +323,7 @@ public String toString() { private MD5Key charsheetImage; private MD5Key portraitImage; - private final List lightSourceList = new ArrayList<>(); + private List lightSourceList = new ArrayList<>(); private String sightType; private boolean hasSight; private Boolean hasImageTable = false; @@ -353,12 +353,12 @@ public String toString() { // help XStream move the data around. private Map propertyMap; // 1.3b77 and earlier - private final CaseInsensitiveHashMap propertyMapCI = new CaseInsensitiveHashMap<>(); + private CaseInsensitiveHashMap propertyMapCI = new CaseInsensitiveHashMap<>(); private Map macroMap; - private final Map macroPropertiesMap = new HashMap<>(); + private Map macroPropertiesMap = new HashMap<>(); - private final Map speechMap = new HashMap<>(); + private Map speechMap = new HashMap<>(); private HeroLabData heroLabData; @@ -2378,6 +2378,9 @@ protected Object readResolve() { // a pre-1.3b78 token that actually has the CaseInsensitiveHashMap. // Newer tokens will use propertyMapCI so we only need to make corrections // if the old field has data in it. + if (propertyMapCI == null) { + propertyMapCI = new CaseInsensitiveHashMap<>(); + } if (propertyMap != null) { propertyMapCI.putAll(propertyMap); propertyMap.clear(); // It'll never be written out, but we should free the memory. @@ -2402,6 +2405,34 @@ protected Object readResolve() { } } + if (ownerList == null) { + ownerList = new HashSet<>(); + } + if (lightSourceList == null) { + lightSourceList = new ArrayList<>(); + } + if (macroPropertiesMap == null) { + macroPropertiesMap = new HashMap<>(); + } + if (speechMap == null) { + speechMap = new HashMap<>(); + } + if (isFlippedIso == null) { + isFlippedIso = false; + } + if (hasImageTable == null) { + hasImageTable = false; + } + if (tokenShape == null) { + tokenShape = TokenShape.SQUARE.toString(); + } + if (tokenType == null) { + tokenType = Type.NPC.toString(); + } + if (speechName == null) { + speechName = ""; + } + return this; } @@ -2840,7 +2871,7 @@ public TokenDto toDto() { dto.setVisibleOnlyToOwner(visibleOnlyToOwner); dto.setVblColorSensitivity(vblColorSensitivity); dto.setAlwaysVisibleTolerance(alwaysVisibleTolerance); - dto.setIsAlwaysVisible(isVisible); + dto.setIsAlwaysVisible(isAlwaysVisible); if (vbl != null) { dto.setVbl(Mapper.map(vbl)); } diff --git a/src/main/java/net/rptools/maptool/model/Zone.java b/src/main/java/net/rptools/maptool/model/Zone.java index 2e17149b5a..b44fa713f5 100644 --- a/src/main/java/net/rptools/maptool/model/Zone.java +++ b/src/main/java/net/rptools/maptool/model/Zone.java @@ -2266,8 +2266,12 @@ public ZoneDto toDto() { dto.addAllLabels(labels.values().stream().map(l -> l.toDto()).collect(Collectors.toList())); dto.addAllTokens(tokenMap.values().stream().map(t -> t.toDto()).collect(Collectors.toList())); exposedAreaMeta.forEach( - (id, area) -> - dto.putExposedAreaMeta(id.toString(), Mapper.map(area.getExposedAreaHistory()))); + (id, area) -> { + if (id == null) { + return; + } + dto.putExposedAreaMeta(id.toString(), Mapper.map(area.getExposedAreaHistory())); + }); dto.setInitiative(initiativeList.toDto()); dto.setExposedArea(Mapper.map(exposedArea)); dto.setHasFog(hasFog);