Skip to content

Commit

Permalink
Catch the case of dumb mods returning a null component in a clearly n…
Browse files Browse the repository at this point in the history
…on-null context. (#4748)
  • Loading branch information
KnightMiner committed Dec 13, 2023
1 parent f449df3 commit 7b35c26
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import javax.annotation.Nullable;
import java.util.List;
import java.util.Objects;

public class BaseTabbedScreen<TILE extends BlockEntity, CONTAINER extends TabbedContainerMenu<TILE>> extends MultiModuleScreen<CONTAINER> {
protected static final Component COMPONENT_WARNING = TConstruct.makeTranslation("gui", "warning");
Expand Down Expand Up @@ -86,7 +87,7 @@ protected void addChestSideInventory(Inventory inventory) {
Component sideInventoryName = TextComponent.EMPTY;
BlockEntity te = sideInventoryContainer.getTile();
if (te instanceof MenuProvider) {
sideInventoryName = ((MenuProvider) te).getDisplayName();
sideInventoryName = Objects.requireNonNullElse(((MenuProvider)te).getDisplayName(), TextComponent.EMPTY);
}

this.addModule(new SideInventoryScreen<>(this, sideInventoryContainer, inventory, sideInventoryName, sideInventoryContainer.getSlotCount(), sideInventoryContainer.getColumns()));
Expand Down

0 comments on commit 7b35c26

Please sign in to comment.