Add null checks for Nullables

This commit is contained in:
Michael Smith 2020-08-23 22:10:59 -07:00
parent b74ead594f
commit ae40b01161
No known key found for this signature in database
GPG Key ID: 41F47A53EDE95BE1
2 changed files with 5 additions and 0 deletions

View File

@ -1454,6 +1454,9 @@ public class Portal {
} }
public static String filterName(String input) { public static String filterName(String input) {
if (input == null) {
return "";
}
return input.replaceAll("[\\|:#]", "").trim(); return input.replaceAll("[\\|:#]", "").trim();
} }

View File

@ -895,6 +895,8 @@ public class Stargate extends JavaPlugin {
Player player = event.getPlayer(); Player player = event.getPlayer();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if(block == null) return;
// Right click // Right click
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (block.getBlockData() instanceof WallSign) { if (block.getBlockData() instanceof WallSign) {