Null-check item signs tag in TagCache#6325
Conversation
Novampr
left a comment
There was a problem hiding this comment.
Approving on the basis that this works, but to note that later we'll probably use ViaVersion packet payload in order to properly determine the server version and what to emulate.
|
Have you tested this? This shouldn't ever be null as it's part of standard tags - if it is, I'm curious if the server then follows up by a proper tags packet |
|
This one specifically I haven't, the stacktrace showed it was reachable. Agreed signs shouldn't normally be null on vanilla, I assume viaversion-wrapped or modded setups where the first tags packet doesn't include it. I'm almost certain this fixes it |
|
I agree that it'll fix the NPE, but if it doesn't fix the actual sign detection, that should be accounted for Signs were, iirc, always sent by Via; did that change? |
|
Good question on Via - I don't know if something changed there. If Via has been consistently sending signs, then null here isn't the "normal pre-1.13" case I was assuming. Without a proper alternate signal (the ViaVersion payload work mentioned earlier), I don't have a clean way to detect what emulatePost1_13Logic should actually be when signs is missing. I can either preserve prior state and stop overriding, log a warning and keep current behavior, or close this and defer to the proper version detection work. My main goal is to stop the crash, but I wouldn't mind working on it further. Whichever works for you. |
|
Actually, I looked into it. Via started sending empty tags packets recently (march-ish) as a placeholder during config stage that gets filled in later. That would explain the null case here. If that's right, probably makes sense to only update emulatePost1_13Logic when signs is actually present, so a later real tags packet handles detection naturally. Or close this and defer, up to you. |
|
Are you able to test whether the signs tag is sent / followed up by via? If that really is followed up, lgtm |
|
Tested it on vanilla Paper 1.21.11 with the PR applied. Signs tag is sent in the initial UPDATE_TAGS, no NPE, signs work normally on Bedrock. The null branch doesn't fire in the vanilla flow since signs is always present, so for vanilla it's just defensive. Don't have a Via setup to verify the follow-up behavior I mentioned earlier, so can't confirm that side. But the fix itself is confirmed safe on vanilla at minimum. |
Fixes #6261.
TagCache.loadPacket NPEs if the server doesn't send the signs item tag. Added a null check like the block branch right above.