Fix null log messages causing an NPE

This commit is contained in:
Josh Roy 2022-08-18 13:36:52 -04:00
parent ca4077b204
commit 5f5d65c463

View File

@ -18,6 +18,9 @@ public class PaperLoggerProvider extends LoggerProvider {
@Override
protected void doTheLog(Level level, String message, Throwable throwable) {
if (message == null) {
return;
}
final Component component = LegacyComponentSerializer.legacySection().deserialize(message);
if (level == Level.SEVERE) {
logger.error(component, throwable);
@ -34,6 +37,9 @@ public class PaperLoggerProvider extends LoggerProvider {
@Override
protected void doTheLog(Level level, String message) {
if (message == null) {
return;
}
final Component component = LegacyComponentSerializer.legacySection().deserialize(message);
if (level == Level.SEVERE) {
logger.error(component);