From dd0207c6054910436028a8431ce736e1433903d1 Mon Sep 17 00:00:00 2001 From: Phergus <34379254+Phergus@users.noreply.github.com> Date: Mon, 15 Aug 2022 14:29:45 -0600 Subject: [PATCH 1/2] Update TokenPropertyFunctions.java Return either an empty string or an empty array if Property Type isn't found. --- .../client/functions/TokenPropertyFunctions.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java b/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java index 52bf1c083b..704727f3c6 100644 --- a/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java +++ b/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java @@ -1176,10 +1176,10 @@ private boolean hasProperty(Token token, String name) { * @throws ParserException */ private String getAllPropertyNames(String type, String delim) throws ParserException { + ArrayList namesList = new ArrayList(); if (type == null || type.length() == 0 || type.equals("*")) { Map> pmap = MapTool.getCampaign().getCampaignProperties().getTokenTypeMap(); - ArrayList namesList = new ArrayList(); for (Entry> entry : pmap.entrySet()) { for (TokenProperty tp : entry.getValue()) { @@ -1196,14 +1196,10 @@ private String getAllPropertyNames(String type, String delim) throws ParserExcep } else { List props = MapTool.getCampaign().getCampaignProperties().getTokenPropertyList(type); - if (props == null) { - throw new ParserException( - I18N.getText( - "macro.function.tokenProperty.unknownPropType", "getAllPropertyNames", type)); - } - ArrayList namesList = new ArrayList(); - for (TokenProperty tp : props) { - namesList.add(tp.getName()); + if (props != null) { + for (TokenProperty tp : props) { + namesList.add(tp.getName()); + } } if ("json".equals(delim)) { JsonArray jarr = new JsonArray(); From ef3305df9a5780539ff0e0e4e0be226c3d713495 Mon Sep 17 00:00:00 2001 From: Phergus <34379254+Phergus@users.noreply.github.com> Date: Mon, 15 Aug 2022 14:37:40 -0600 Subject: [PATCH 2/2] Update TokenPropertyFunctions.java Comments --- .../rptools/maptool/client/functions/TokenPropertyFunctions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java b/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java index 704727f3c6..6edd203686 100644 --- a/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java +++ b/src/main/java/net/rptools/maptool/client/functions/TokenPropertyFunctions.java @@ -1196,6 +1196,7 @@ private String getAllPropertyNames(String type, String delim) throws ParserExcep } else { List props = MapTool.getCampaign().getCampaignProperties().getTokenPropertyList(type); + // If property type not found return an empty string or JSON array if (props != null) { for (TokenProperty tp : props) { namesList.add(tp.getName());