From 150ad134479560c77037e8e987dff8e561cb96a4 Mon Sep 17 00:00:00 2001 From: zrdzn Date: Fri, 29 Apr 2022 14:34:48 +0200 Subject: [PATCH] Fix filler getter throwing NPE if disabled --- .../java/io/github/zrdzn/minecraft/lovelydrop/menu/Menu.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/Menu.java b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/Menu.java index e17dccd..cff9177 100644 --- a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/Menu.java +++ b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/Menu.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map.Entry; +import java.util.Optional; public class Menu { @@ -49,8 +50,8 @@ public int getRows() { return this.rows; } - public ItemStack getFiller() { - return this.filler.clone(); + public Optional getFiller() { + return this.filler == null ? Optional.empty() : Optional.of(this.filler.clone()); } public Entry getDropSwitch() {