From 6e5b1e81aed490e2b87573719aea0e229f195f7f Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 23 Jul 2024 07:21:05 -0400 Subject: [PATCH] Crash fix --- core/src/mindustry/entities/comp/PlayerComp.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index 0ed2a11ad4..9ea4ccf30e 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -297,7 +297,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra font.getData().setScale(0.25f / Scl.scl(1f)); layout.setText(font, name); - if(!isLocal()){ + if(!isLocal() && unit != null){ Draw.color(0f, 0f, 0f, 0.3f); Fill.rect(unit.x, unit.y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3); Draw.color(); @@ -313,7 +313,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra } } - if(Core.settings.getBool("playerchat") && ((textFadeTime > 0 && lastText != null) || typing)){ + if(unit != null && Core.settings.getBool("playerchat") && ((textFadeTime > 0 && lastText != null) || typing)){ String text = textFadeTime <= 0 || lastText == null ? "[lightgray]" + Strings.animated(Time.time, 4, 15f, ".") : lastText; float width = 100f; float visualFadeTime = 1f - Mathf.curve(1f - textFadeTime, 0.9f);