mojira.dev
MC-92867

Setting Json text value to null throws exceptions and crashes

The bug

When you use "text":null for command blocks and signs, an exception is thrown and in the worst case (falling_block) the game crashes.

How to reproduce

/summon falling_block ~ ~5 ~ {Time:1,BlockState:{Name:"minecraft:oak_sign"},TileEntityData:{Text1:"{\"text\":null}"}}

Crash report

1.13.1: crash-2018-08-22_23.51.39-server.txt

Description: Ticking entity

java.lang.UnsupportedOperationException: JsonNull
	at com.google.gson.JsonElement.getAsString(JsonElement.java:191)
	at ij$a.a(SourceFile:215)
	at ij$a.deserialize(SourceFile:174)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
	at xj.a(SourceFile:497)
	at xj.a(SourceFile:522)
	at ij$a.a(SourceFile:369)
	at bkb.b(SourceFile:56)
	at amk.R_(SourceFile:178)
	at axx.a(SourceFile:1243)
	at td.a(SourceFile:575)
	at axx.g(SourceFile:1218)
	at axx.o_(SourceFile:1100)
	at td.o_(SourceFile:491)
	at net.minecraft.server.MinecraftServer.b(SourceFile:755)
	at net.minecraft.server.MinecraftServer.a(SourceFile:681)
	at dgg.a(SourceFile:131)
	at net.minecraft.server.MinecraftServer.run(SourceFile:584)
	at java.lang.Thread.run(Thread.java:745)

Linked issues

Attachments

Comments

jamesmoton

Can confirm for 1.16.1, but crashes with a different error:

com.google.gson.JsonSyntaxException: Expected text to be a string, was null (json)

marcono1234

boq

Confirmed

Very Important

Crash

crash, falling_block, json, null, null-pointer-exception, sign, text

Minecraft 15w46a, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w42a, Minecraft 1.11, ..., Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, 1.15.2, 20w18a, 20w21a

21w03a

Retrieved