Fix potential NullPointerExceptions

This commit is contained in:
Phoenix616 2023-03-01 18:14:18 +01:00
parent a38f309453
commit 199573df59
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
3 changed files with 12 additions and 8 deletions

View File

@ -16,6 +16,7 @@ public class GarbageTextListener implements Listener {
public static void filterGarbage(SignChangeEvent event) {
for (int i = 0; i < 4; ++i) {
String line = event.getLine(i);
if (line != null) {
StringBuilder output = new StringBuilder(line.length());
for (char character : line.toCharArray()) {
@ -28,3 +29,4 @@ public class GarbageTextListener implements Listener {
}
}
}
}

View File

@ -52,7 +52,9 @@ public class EmptyShopDeleter implements Listener {
sign.getBlock().setType(Material.AIR);
if (Properties.REMOVE_EMPTY_CHESTS && !ChestShopSign.isAdminShop(ownerInventory) && InventoryUtil.isEmpty(ownerInventory)) {
if (connectedContainer != null) {
connectedContainer.getBlock().setType(Material.AIR);
}
} else {
if (!signType.isItem()) {
try {

View File

@ -221,7 +221,7 @@ public class uBlock {
Sign sign = (Sign) faceBlock.getState();
Container signContainer = findConnectedContainer(sign);
if (!chestBlock.equals(signContainer.getBlock())) {
if (signContainer == null || !chestBlock.equals(signContainer.getBlock())) {
continue;
}