Skip to content

Commit

Permalink
Fix NPE when running /usepack from console
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenix616 committed May 23, 2017
1 parent 661ac93 commit a9bd5be
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public boolean execute(ResourcepacksPlayer sender, String[] args) {
plugin.sendMessage(sender, ChatColor.GREEN + plugin.getMessage("packlisthead"));
List<ResourcePack> packs = plugin.getPackManager().getPacks();
if(packs.size() > 0) {
ResourcePack userPack = plugin.getUserManager().getUserPack(sender.getUniqueId());
List<ResourcePack> applicablePacks = new ArrayList<ResourcePack>();
ResourcePack userPack = sender != null ? plugin.getUserManager().getUserPack(sender.getUniqueId()) : null;
List<ResourcePack> 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);
}
}
Expand Down

0 comments on commit a9bd5be

Please sign in to comment.