Fixed legacyToJson nullability bug

This commit is contained in:
Auxilor
2021-09-24 09:49:54 +01:00
parent aa52dcdf94
commit ad68e1efef

View File

@@ -336,10 +336,14 @@ public class StringUtils {
* @return The JSON String.
*/
@NotNull
public String legacyToJson(@NotNull final String legacy) {
public String legacyToJson(@Nullable final String legacy) {
String processed = legacy;
if (legacy == null) {
processed = "";
}
return GsonComponentSerializer.gson().serialize(
Component.empty().decoration(TextDecoration.ITALIC, false).append(
LEGACY_COMPONENT_SERIALIZER.deserialize(legacy)
LEGACY_COMPONENT_SERIALIZER.deserialize(processed)
)
);
}