Fix potential NullPointerExceptions
This commit is contained in:
parent
a38f309453
commit
199573df59
|
@ -16,15 +16,17 @@ public class GarbageTextListener implements Listener {
|
|||
public static void filterGarbage(SignChangeEvent event) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
String line = event.getLine(i);
|
||||
StringBuilder output = new StringBuilder(line.length());
|
||||
if (line != null) {
|
||||
StringBuilder output = new StringBuilder(line.length());
|
||||
|
||||
for (char character : line.toCharArray()) {
|
||||
if (character < 0xF700 || character > 0xF747) {
|
||||
output.append(character);
|
||||
for (char character : line.toCharArray()) {
|
||||
if (character < 0xF700 || character > 0xF747) {
|
||||
output.append(character);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.setLine(i, output.toString());
|
||||
event.setLine(i, output.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
connectedContainer.getBlock().setType(Material.AIR);
|
||||
if (connectedContainer != null) {
|
||||
connectedContainer.getBlock().setType(Material.AIR);
|
||||
}
|
||||
} else {
|
||||
if (!signType.isItem()) {
|
||||
try {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue