Fixed rare NPE

This commit is contained in:
Auxilor 2021-05-11 21:14:09 +01:00
parent 7303c6b2de
commit bb3f897312

View File

@ -204,7 +204,9 @@ public class EnchantingListeners extends PluginDependent implements Listener {
// Ew
this.getPlugin().getScheduler().runLater(() -> {
ItemStack item0 = event.getInventory().getItem(0);
assert item0 != null;
if (item0 == null) {
return;
}
if (item0.getItemMeta() instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item0.getItemMeta();
for (Enchantment enchantment : meta.getStoredEnchants().keySet()) {