From 544f6f69fef93e74e3903c8c430ae637ee65659c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Mon, 17 Jan 2022 18:13:48 +0100 Subject: [PATCH] Fixes a NullPointerException caused by getting the size of a null list --- .../net/knarcraft/bookswithoutborders/utility/FileHelper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java b/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java index b1b05e7..b5afa47 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/utility/FileHelper.java @@ -122,6 +122,9 @@ public final class FileHelper { */ public static void printFiles(CommandSender sender, List fileList) { BooksWithoutBorders.sendSuccessMessage(sender, "Available Books:"); + if (fileList == null) { + return; + } int listSize = fileList.size(); for (int fileIndex = 0; fileIndex < listSize; fileIndex++) { sender.sendMessage(ChatColor.GRAY + "[" + (fileIndex + 1) + "] " + fileList.get(fileIndex));