Skip to content

Commit

Permalink
Check for empty component in JavaSetTitleTextTranslator
Browse files Browse the repository at this point in the history
  • Loading branch information
Redned235 committed Dec 29, 2021
1 parent c6c2ff9 commit 7beedb4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket;
import com.nukkitx.protocol.bedrock.packet.SetTitlePacket;
import net.kyori.adventure.text.Component;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
Expand All @@ -38,7 +39,7 @@ public class JavaSetTitleTextTranslator extends PacketTranslator<ClientboundSetT
@Override
public void translate(GeyserSession session, ClientboundSetTitleTextPacket packet) {
String text;
if (packet.getText() == null) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447
if (packet.getText() == null || Component.empty().equals(packet.getText())) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447
text = " ";
} else {
text = MessageTranslator.convertMessage(packet.getText(), session.getLocale());
Expand Down

0 comments on commit 7beedb4

Please sign in to comment.