Fixes a NullPointerException caused by getting the size of a null list

This commit is contained in:
Kristian Knarvik 2022-01-17 18:13:48 +01:00
parent 055d7fca60
commit 544f6f69fe

View File

@ -122,6 +122,9 @@ public final class FileHelper {
*/
public static void printFiles(CommandSender sender, List<String> 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));