Fixes a NullPointerException caused by getting the size of a null list
This commit is contained in:
parent
055d7fca60
commit
544f6f69fe
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user