Skip to content

Commit

Permalink
- Fix potential IllegalArgumentException by loading sanctioned towns
Browse files Browse the repository at this point in the history
in a safer way.
  • Loading branch information
LlmDl committed Dec 22, 2023
1 parent f320915 commit e82ee03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Towny/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<artifactId>towny</artifactId>
<packaging>jar</packaging>
<version>0.100.0.13</version>
<version>0.100.0.14</version>

<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,13 @@ public List<String> getSanctionedTownsForSaving() {

public void loadSanctionedTowns(String[] tokens) {
for (String stringUUID : tokens) {
UUID uuid = UUID.fromString(stringUUID);
if (uuid != null && TownyAPI.getInstance().getTown(uuid) != null)
sanctionedTowns.add(TownyAPI.getInstance().getTown(uuid));
try {
Town town = TownyAPI.getInstance().getTown(UUID.fromString(stringUUID));
if (town != null)
sanctionedTowns.add(town);
} catch (IllegalArgumentException ignored) {
continue;
}
}
}
}
4 changes: 3 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9313,4 +9313,6 @@ v0.92.0.11:
- API: Added NationSanctionTownAddEvent
- A cancellable event which is fired before a town becomes sanctioned.
- API: Added NationSanctionTownRemoveEvent
- A cancellable event which is fired before a town becomes unsanctioned.
- A cancellable event which is fired before a town becomes unsanctioned.
0.100.0.14:
- Fix potential IllegalArgumentException by loading sanctioned towns in a safer way.

0 comments on commit e82ee03

Please sign in to comment.