Added defensive code for JUnit testing

This commit is contained in:
tastybento 2024-05-31 17:11:43 -07:00
parent 8e68349004
commit 475f6372e2

View File

@ -1646,7 +1646,8 @@ public class IslandsManager {
* @param island - island
*/
public static void updateIsland(Island island) {
if (handler.objectExists(island.getUniqueId())) {
// When mocking, handler can be null so this null check avoids errors
if (handler != null && handler.objectExists(island.getUniqueId())) {
island.clearChanged();
handler.saveObjectAsync(island)
.thenAccept(b -> MultiLib.notify("bentobox-updateIsland", island.getUniqueId()));