Fix NPE in item stack sort comparator

This commit is contained in:
Gabriel Tofvesson 2021-04-24 00:01:28 +02:00
parent 76211d5b2f
commit 4def617332

View File

@ -91,6 +91,9 @@ public class SortCommandExecutor implements CommandExecutor {
private static class ItemStackComparator implements Comparator<ItemStack> {
@Override
public int compare(ItemStack o1, ItemStack o2) {
if (o1 == null || o2 == null)
return o1 == o2 ? 0 : o1 == null ? 1 : -1;
final Material m1 = o1.getType();
final Material m2 = o2.getType();