Skip to content

Commit c1f0b37

Browse files
committed
Fix potential NPE
1 parent ae4c651 commit c1f0b37

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/teammoeg/frostedheart/content/health/tooltip/FoodNutritionStats.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ public static FoodNutritionStats create(Item item) {
6060
public void modify(ItemTooltipEvent context) {
6161
final ItemStack stack=context.getItemStack();
6262
final Player player=context.getEntity();
63+
List<Component> stats = getFoodStats(stack, player);
6364

64-
if (FoodTemperatureHandler.isFoodOrDrink(stack)) {
65-
KeyControlledDesc desc = new KeyControlledDesc(()->getFoodStats(stack, player),
65+
if (FoodTemperatureHandler.isFoodOrDrink(stack) && stats != null && !stats.isEmpty()) {
66+
KeyControlledDesc desc = new KeyControlledDesc(()->stats,
6667
GLFW.GLFW_KEY_N,
6768
"N",
6869
"holdForNutrition"

0 commit comments

Comments
 (0)