Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard recipe serializers against supplying null codecs #693

Open
Shadows-of-Fire opened this issue Mar 8, 2024 · 1 comment
Open

Guard recipe serializers against supplying null codecs #693

Shadows-of-Fire opened this issue Mar 8, 2024 · 1 comment
Labels
1.20 Targeted at Minecraft 1.20 enhancement New (or improvement to existing) feature or request

Comments

@Shadows-of-Fire
Copy link
Contributor

Returning null from RecipeSerializer#codec() produces a nonsensical gibberish error - we should validate them at registration time or shortly thereafter.

java.lang.NullPointerException: Cannot invoke "com.mojang.serialization.Decoder.decode(com.mojang.serialization.DynamicOps, Object)" because "c" is null
	at com.mojang.serialization.codecs.KeyDispatchCodec.lambda$decode$3(KeyDispatchCodec.java:72) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.lambda$flatMap$11(DataResult.java:139) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.flatMap(DataResult.java:137) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.codecs.KeyDispatchCodec.lambda$decode$4(KeyDispatchCodec.java:58) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.lambda$flatMap$11(DataResult.java:139) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.flatMap(DataResult.java:137) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.codecs.KeyDispatchCodec.decode(KeyDispatchCodec.java:56) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.MapDecoder.lambda$compressedDecode$1(MapDecoder.java:52) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.lambda$flatMap$11(DataResult.java:139) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.datafixers.util.Either$Left.map(Either.java:38) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.DataResult.flatMap(DataResult.java:137) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.MapDecoder.compressedDecode(MapDecoder.java:52) ~[datafixerupper-6.0.8.jar:?] {}
	at com.mojang.serialization.MapCodec$MapCodecCodec.decode(MapCodec.java:91) ~[datafixerupper-6.0.8.jar:?] {}
	at net.neoforged.neoforge.common.conditions.ConditionalOps$ConditionalDecoder.lambda$decode$9(ConditionalOps.java:205) ~[neoforge-20.4.194.jar:?] {re:classloading}
@Shadows-of-Fire Shadows-of-Fire added enhancement New (or improvement to existing) feature or request 1.20 Targeted at Minecraft 1.20 labels Mar 8, 2024
@Technici4n
Copy link
Member

How did that even happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Targeted at Minecraft 1.20 enhancement New (or improvement to existing) feature or request
Projects
None yet
Development

No branches or pull requests

2 participants