mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Fix crash from invalid ingredient lists in VillagerAcquireTradeEvent
This commit is contained in:
parent
dad7e25da8
commit
5b7474984b
1 changed files with 6 additions and 2 deletions
|
@ -54,7 +54,7 @@
|
|||
Logger logger = AbstractVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -246,7 +266,16 @@
|
||||
@@ -246,7 +266,20 @@
|
||||
MerchantOffer merchantrecipe = ((VillagerTrades.ItemListing) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
|
@ -66,7 +66,11 @@
|
|||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (!event.isCancelled()) {
|
||||
+ recipeList.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
||||
+ // Paper start - Fix crash from invalid ingredient list
|
||||
+ final CraftMerchantRecipe craftMerchantRecipe = CraftMerchantRecipe.fromBukkit(event.getRecipe());
|
||||
+ if (craftMerchantRecipe.getIngredients().isEmpty()) return;
|
||||
+ recipeList.add(craftMerchantRecipe.toMinecraft());
|
||||
+ // Paper end - Fix crash from invalid ingredient list
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
++j;
|
||||
|
|
Loading…
Reference in a new issue