question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`isIn` on item sometimes causes NPE in TagDelegate

See original GitHub issue

This is a really mysterious bug.

I’ve got a mixin on Block#calcBlockBreakingDelta that checks if the item the player is holding is in a specific tag, using isIn. When this happens, sometimes an NPE is thrown from TagDelegate#contains.

However, nothing seems to be null.

idea64_2019-11-03_02-46-25

This happens roughly 1 in every 5 runs randomly, and only once. This is the deepest in the stack trace reported.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
liachcommented, Aug 27, 2020

@uiytt You misunderstood here. BlockTags are vanilla tags using vanilla constructs. This problem is with fabric api-provided identified tags that doesn’t always update when vanilla tag managers reload from disc.

1reaction
uiyttcommented, Aug 27, 2020

Since that in 1.16 minecraft check when every block is broken for :

this.isIn(BlockTags.GUARDED_BY_PIGLINS)

And while playing minecraft in .16.2 with fabric Loader 0.9.2+build.206 and fabric-api 0.19.0+build.398-1.16, I never had a single crash or error for TagDelegate#contains. I assume this mean it was fixed.

EDIT : Sorry for the wrong test 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - What is a NullPointerException, and how do I fix it?
Yes check if the object equals null before you invoke a method on it or try to access a variable it might have....
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
Some of the common reasons for NullPointerException in java programs are: Invoking a method on an object instance but at runtime the object...
Read more >
How to deal with NullPointerException in Java with Examples
1. Java NullPointerException while calling instance method on null object. This is probably the most common cause of this error, you ...
Read more >
NullPointerException de-reference a null object in Apex code ...
Knowledge Article Number, 000385601. Description. The execution of a trigger will sometimes generate an error message, "execution of [EventName] caused by: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found