From ef2f76c4c4e38004a462cf2d95ebd275e3ac3c9c Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Mon, 13 May 2019 13:09:35 +0200 Subject: [PATCH] Bug fix --- src/com/massivecraft/factions/TerritoryAccess.java | 3 +++ .../massivecraft/factions/adapter/TerritoryAccessAdapter.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/TerritoryAccess.java b/src/com/massivecraft/factions/TerritoryAccess.java index 1b1ee0e2..40141cd7 100644 --- a/src/com/massivecraft/factions/TerritoryAccess.java +++ b/src/com/massivecraft/factions/TerritoryAccess.java @@ -120,11 +120,14 @@ public class TerritoryAccess public static TerritoryAccess valueOf(String hostFactionId, Boolean hostFactionAllowed, Collection grantedIds) { + if (hostFactionId == null) throw new NullPointerException("hostFactionId"); + if (grantedIds == null) throw new NullPointerException("grantedIds"); return new TerritoryAccess(hostFactionId, hostFactionAllowed, grantedIds); } public static TerritoryAccess valueOf(String hostFactionId) { + if (hostFactionId == null) throw new NullPointerException("hostFactionId"); return valueOf(hostFactionId, null, Collections.emptySet()); } diff --git a/src/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java b/src/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java index afb8ff39..8a4d2354 100644 --- a/src/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java +++ b/src/com/massivecraft/factions/adapter/TerritoryAccessAdapter.java @@ -14,6 +14,7 @@ import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.massivecore.store.migrator.MigratorUtil; import java.lang.reflect.Type; +import java.util.Collections; import java.util.Set; public class TerritoryAccessAdapter implements JsonDeserializer, JsonSerializer @@ -57,7 +58,7 @@ public class TerritoryAccessAdapter implements JsonDeserializer // Prepare variables String hostFactionId = null; Boolean hostFactionAllowed = null; - Set grantedIds = null; + Set grantedIds = Collections.emptySet(); // Read variables (test old values first) JsonElement element = null;