Fix NullPointerException in VirtualInventory#getItems

This commit is contained in:
NichtStudioCode 2021-04-21 21:42:32 +02:00
parent edde43b1ae
commit cab14d0047

@ -80,7 +80,9 @@ public class VirtualInventory implements ConfigurationSerializable {
* @return A copy of the {@link ItemStack}s in this {@link VirtualInventory} * @return A copy of the {@link ItemStack}s in this {@link VirtualInventory}
*/ */
public ItemStack[] getItems() { public ItemStack[] getItems() {
return Arrays.stream(items).map(ItemStack::clone).toArray(ItemStack[]::new); return Arrays.stream(items)
.map(itemStack -> itemStack != null ? itemStack.clone() : null)
.toArray(ItemStack[]::new);
} }
/** /**