Skip to content

Commit

Permalink
clarify again
Browse files Browse the repository at this point in the history
  • Loading branch information
hiisuuii authored Jan 27, 2024
1 parent 64323f6 commit 8173d83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tags/faq/assert.ytag
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ type: text

---

You should avoid using `assert` in your mod code. If the assert passes, it will work as expected. However, if it fails, Minecraft will crash. Assertions are also disabled by default in the JVM, and will be ignored, which may lead to undefined behavior and potentially a NullPointerException.
You should avoid using `assert` in your mod code. If the assert passes, it will work as expected. However, if it fails, Minecraft will crash. Assertions are also disabled by default in the JVM, and will be ignored when your mod is run outside an IDE, which may lead to undefined behavior and potentially a NullPointerException.
Instead of using the assertion pattern `assert someObject != null;`, you should use the null-checking pattern: `if (someObject != null) { /* Code here */ }

0 comments on commit 8173d83

Please sign in to comment.