From b92b49b5e492fc8dd6061ff925a8149bdfb4cbe3 Mon Sep 17 00:00:00 2001 From: YHDiamond <47502993+YHDiamond@users.noreply.github.com> Date: Wed, 17 Nov 2021 21:42:54 -0500 Subject: [PATCH] Handle a string possibly being null (#2638) An NPE can be thrown if message is null and `message.isBlank()` is called. --- .../connector/network/translators/chat/MessageTranslator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index 55087de0f..a668b3906 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -147,6 +147,9 @@ public class MessageTranslator { * @return Bedrock formatted message */ public static String convertMessageLenient(String message, String locale) { + if (message == null) { + return ""; + } if (message.isBlank()) { return message; }