Handle a string possibly being null (#2638)

An NPE can be thrown if message is null and `message.isBlank()` is called.
This commit is contained in:
YHDiamond 2021-11-17 21:42:54 -05:00 committed by GitHub
parent 581c24f2e9
commit b92b49b5e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}