Fixes a NullPointerException caused by getting the size of a null list
This commit is contained in:
		| @@ -122,6 +122,9 @@ public final class FileHelper { | |||||||
|      */ |      */ | ||||||
|     public static void printFiles(CommandSender sender, List<String> fileList) { |     public static void printFiles(CommandSender sender, List<String> fileList) { | ||||||
|         BooksWithoutBorders.sendSuccessMessage(sender, "Available Books:"); |         BooksWithoutBorders.sendSuccessMessage(sender, "Available Books:"); | ||||||
|  |         if (fileList == null) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|         int listSize = fileList.size(); |         int listSize = fileList.size(); | ||||||
|         for (int fileIndex = 0; fileIndex < listSize; fileIndex++) { |         for (int fileIndex = 0; fileIndex < listSize; fileIndex++) { | ||||||
|             sender.sendMessage(ChatColor.GRAY + "[" + (fileIndex + 1) + "] " + fileList.get(fileIndex)); |             sender.sendMessage(ChatColor.GRAY + "[" + (fileIndex + 1) + "] " + fileList.get(fileIndex)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user