From a9bd5bede2a248a8bec7139ff09d74467f4a5408 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Tue, 23 May 2017 15:48:59 +0100 Subject: [PATCH] Fix NPE when running /usepack from console --- .../core/commands/UsePackCommandExecutor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/de/themoep/resourcepacksplugin/core/commands/UsePackCommandExecutor.java b/core/src/main/java/de/themoep/resourcepacksplugin/core/commands/UsePackCommandExecutor.java index f9b8b5f6..fc6aa555 100644 --- a/core/src/main/java/de/themoep/resourcepacksplugin/core/commands/UsePackCommandExecutor.java +++ b/core/src/main/java/de/themoep/resourcepacksplugin/core/commands/UsePackCommandExecutor.java @@ -59,10 +59,10 @@ public boolean execute(ResourcepacksPlayer sender, String[] args) { plugin.sendMessage(sender, ChatColor.GREEN + plugin.getMessage("packlisthead")); List packs = plugin.getPackManager().getPacks(); if(packs.size() > 0) { - ResourcePack userPack = plugin.getUserManager().getUserPack(sender.getUniqueId()); - List applicablePacks = new ArrayList(); + ResourcePack userPack = sender != null ? plugin.getUserManager().getUserPack(sender.getUniqueId()) : null; + List applicablePacks = new ArrayList<>(); for(ResourcePack pack : packs) { - if(pack.getFormat() <= plugin.getPlayerPackFormat(sender.getUniqueId()) && plugin.checkPermission(sender, pack.getPermission())) { + if(sender == null || pack.getFormat() <= plugin.getPlayerPackFormat(sender.getUniqueId()) && plugin.checkPermission(sender, pack.getPermission())) { applicablePacks.add(pack); } }