From a99bbee90017f38448e6a1915edf5d4ee40b6216 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 4 Jul 2021 21:42:48 +0200 Subject: [PATCH] Fix possible nullref --- .../main/java/org/dynmap/fabric_1_14_4/DynmapPlugin.java | 6 +++--- .../main/java/org/dynmap/fabric_1_15_2/DynmapPlugin.java | 6 +++--- .../main/java/org/dynmap/fabric_1_16_1/DynmapPlugin.java | 6 +++--- .../main/java/org/dynmap/fabric_1_16_2/DynmapPlugin.java | 6 +++--- .../main/java/org/dynmap/fabric_1_16_4/DynmapPlugin.java | 6 +++--- .../src/main/java/org/dynmap/fabric_1_17/DynmapPlugin.java | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fabric-1.14.4/src/main/java/org/dynmap/fabric_1_14_4/DynmapPlugin.java b/fabric-1.14.4/src/main/java/org/dynmap/fabric_1_14_4/DynmapPlugin.java index dc292e52..535bc8ad 100644 --- a/fabric-1.14.4/src/main/java/org/dynmap/fabric_1_14_4/DynmapPlugin.java +++ b/fabric-1.14.4/src/main/java/org/dynmap/fabric_1_14_4/DynmapPlugin.java @@ -179,7 +179,7 @@ public class DynmapPlugin { int idx = bsids.getId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -330,7 +330,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -338,7 +338,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission))) { return true; } return permissions.hasPermissionNode(psender, permission); diff --git a/fabric-1.15.2/src/main/java/org/dynmap/fabric_1_15_2/DynmapPlugin.java b/fabric-1.15.2/src/main/java/org/dynmap/fabric_1_15_2/DynmapPlugin.java index 641d084c..278bc9d2 100644 --- a/fabric-1.15.2/src/main/java/org/dynmap/fabric_1_15_2/DynmapPlugin.java +++ b/fabric-1.15.2/src/main/java/org/dynmap/fabric_1_15_2/DynmapPlugin.java @@ -179,7 +179,7 @@ public class DynmapPlugin { int idx = bsids.getId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -330,7 +330,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -338,7 +338,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission))) { return true; } return permissions.hasPermissionNode(psender, permission); diff --git a/fabric-1.16.1/src/main/java/org/dynmap/fabric_1_16_1/DynmapPlugin.java b/fabric-1.16.1/src/main/java/org/dynmap/fabric_1_16_1/DynmapPlugin.java index 6dd33db3..702ff5d3 100644 --- a/fabric-1.16.1/src/main/java/org/dynmap/fabric_1_16_1/DynmapPlugin.java +++ b/fabric-1.16.1/src/main/java/org/dynmap/fabric_1_16_1/DynmapPlugin.java @@ -177,7 +177,7 @@ public class DynmapPlugin { int idx = bsids.getId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -328,7 +328,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -336,7 +336,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission))) { return true; } return permissions.hasPermissionNode(psender, permission); diff --git a/fabric-1.16.2/src/main/java/org/dynmap/fabric_1_16_2/DynmapPlugin.java b/fabric-1.16.2/src/main/java/org/dynmap/fabric_1_16_2/DynmapPlugin.java index 79e2d6f7..e2b24df7 100644 --- a/fabric-1.16.2/src/main/java/org/dynmap/fabric_1_16_2/DynmapPlugin.java +++ b/fabric-1.16.2/src/main/java/org/dynmap/fabric_1_16_2/DynmapPlugin.java @@ -177,7 +177,7 @@ public class DynmapPlugin { int idx = bsids.getRawId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -314,7 +314,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -322,7 +322,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission))) { return true; } return permissions.hasPermissionNode(psender, permission); diff --git a/fabric-1.16.4/src/main/java/org/dynmap/fabric_1_16_4/DynmapPlugin.java b/fabric-1.16.4/src/main/java/org/dynmap/fabric_1_16_4/DynmapPlugin.java index 1bbc77bd..f752d0ae 100644 --- a/fabric-1.16.4/src/main/java/org/dynmap/fabric_1_16_4/DynmapPlugin.java +++ b/fabric-1.16.4/src/main/java/org/dynmap/fabric_1_16_4/DynmapPlugin.java @@ -177,7 +177,7 @@ public class DynmapPlugin { int idx = bsids.getRawId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -314,7 +314,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -322,7 +322,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission))) { return true; } return permissions.hasPermissionNode(psender, permission); diff --git a/fabric-1.17/src/main/java/org/dynmap/fabric_1_17/DynmapPlugin.java b/fabric-1.17/src/main/java/org/dynmap/fabric_1_17/DynmapPlugin.java index 99949fc3..323418c2 100644 --- a/fabric-1.17/src/main/java/org/dynmap/fabric_1_17/DynmapPlugin.java +++ b/fabric-1.17/src/main/java/org/dynmap/fabric_1_17/DynmapPlugin.java @@ -178,7 +178,7 @@ public class DynmapPlugin { int idx = bsids.getRawId(bs); if (idx >= stateByID.length) { int plen = stateByID.length; - stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% + stateByID = Arrays.copyOf(stateByID, idx*11/10); // grow array by 10% Arrays.fill(stateByID, plen, stateByID.length, DynmapBlockState.AIR); } Block b = bs.getBlock(); @@ -315,7 +315,7 @@ public class DynmapPlugin { boolean hasPerm(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermission(psender.getName().getString(), permission)) { return true; } return permissions.has(psender, permission); @@ -323,7 +323,7 @@ public class DynmapPlugin { boolean hasPermNode(PlayerEntity psender, String permission) { PermissionsHandler ph = PermissionsHandler.getHandler(); - if ((psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { + if ((ph != null) && (psender != null) && ph.hasPermissionNode(psender.getName().getString(), permission)) { return true; } return permissions.hasPermissionNode(psender, permission);