From 297b99a0ba2a8c971d75cc1cb0a970aedb877618 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Sun, 28 Feb 2021 07:44:03 +0100 Subject: [PATCH] Fix NPE --- .../gamingmesh/jobs/stuff/complement/Complement2.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java index 6426e628..2f1abfe6 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement2.java @@ -26,12 +26,12 @@ public final class Complement2 implements Complement { @Override public String getDisplayName(ItemMeta meta) { - return serialize(meta.displayName()); + return meta.displayName() == null ? null : serialize(meta.displayName()); } @Override public String getLine(SignChangeEvent event, int line) { - return serialize(event.line(line)); + return event.line(line) == null ? "" : serialize(event.line(line)); } @Override @@ -79,8 +79,10 @@ public final class Complement2 implements Complement { public List getLore(ItemMeta meta) { List lore = new ArrayList<>(); - for (Component comp : meta.lore()) { - lore.add(serialize(comp)); + if (meta.hasLore()) { + for (Component comp : meta.lore()) { + lore.add(serialize(comp)); + } } return lore;