From 4f43db73907efb8fe39ed9c1bc2ed61407176ef2 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Wed, 4 May 2016 21:22:52 +0200 Subject: [PATCH] Fix NPE on interact while creating portal --- .../java/io/github/dre2n/dungeonsxl/global/DPortal.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/global/DPortal.java b/src/main/java/io/github/dre2n/dungeonsxl/global/DPortal.java index 26549e26..51229d60 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/global/DPortal.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/global/DPortal.java @@ -24,6 +24,7 @@ import io.github.dre2n.dungeonsxl.game.Game; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.world.GameWorld; +import java.util.HashSet; import java.util.Set; import org.bukkit.Location; import org.bukkit.Material; @@ -210,7 +211,11 @@ public class DPortal extends GlobalProtection { @Override public Set getBlocks() { if (blocks == null) { - blocks = BlockUtil.getBlocksBetween(block1, block2); + if (block1 != null && block2 != null) { + blocks = BlockUtil.getBlocksBetween(block1, block2); + } else { + blocks = new HashSet<>(); + } } return blocks;