mojira.dev
MC-69794

The "sell" tag from The "Offers" tag from summoning a Villager does not work making it crash the game

Well this is embarrassing I was trying to summon a Villager with a custom trade but there was nothing in the sell slot. Making the game crash.

"----Minecraft Crash Report---
//Uh... Did I do that

Time: 8/28/14 10:19 AM

java.lang.NullPointerExeption: Updating screen events"

Attachments

Comments 4

Crash report is incomplete, also, latets version is 1.8 pre3

Here is a crash report that resulted from the bug, tested in 1.8.

Please provide the exact command you've used.

entitydata @e[type=Villager] {Offers:{Recipes:[0:{maxUses:1,buy:{id:"minecraft:emerald",Damage:0s,Count:1b}}]}}

This command causes the game to crash upon placing the specified item in the 'buy' slot when trading with an affected villager.
(Also happens when the buyB tag is provided, where placing both specified items crashes the game)

Attempting the same command with the sell tag enabled but with no item specified will also crash the game.

entitydata @e[type=Villager] {Offers:{Recipes:[0:{maxUses:1,buy:{id:"minecraft:emerald",Damage:0s,Count:1b},sell:{ }}]}}

A simple fix might involve setting a default value to the item being sold, so if the sell tag is missing or does not include an item id, there will not be some invalid/unused value set for it.

I don't have much experience with programming, but I know that trying to use an uninitialized variable will result in an error.

Adam Zapasnik

(Unassigned)

Unconfirmed

Minecraft 1.8-pre2

Retrieved