Skip to content

Commit

Permalink
Fix crash with TC NEI & other handlers with null or short/empty `getR…
Browse files Browse the repository at this point in the history
…ecipeName()`
  • Loading branch information
mitchej123 committed May 16, 2021
1 parent 344b22a commit 5fdb582
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mc_version=1.7.10
forge_version=10.13.4.1614-1.7.10
ccl_version=1.1.3.138
ccc_version=1.0.7.+
mod_version=2.1.2-GTNH
mod_version=2.1.3-GTNH
10 changes: 9 additions & 1 deletion src/codechicken/nei/recipe/GuiRecipeTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ public void drawForeground(int mouseX, int mouseY) {
GuiContainerManager.drawItems.zLevel -= 100;
} else {
// Text fallback
String text = handler.getRecipeName().substring(0, 2);
String text = handler.getRecipeName();
if (text != null && text.length() > 0) {
if (text.length() > 2) {
text = text.substring(0, 2);
}
} else {
text = "??";
}

int textCenterX = x + (int) (getWidth() / 2f);
int textCenterY = y + (int) (getHeight() / 2f) - 3;
int color = selected ? 0xffffa0 : 0xe0e0e0;
Expand Down

0 comments on commit 5fdb582

Please sign in to comment.