Skip to content

Commit

Permalink
Added null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakky54 committed Nov 17, 2024
1 parent 1ba7595 commit bfc189f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/nl/altindag/log/mapper/LogEventMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public LogEvent apply(ILoggingEvent iLoggingEvent) {
String threadName = iLoggingEvent.getThreadName();
ZonedDateTime timeStamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(iLoggingEvent.getTimeStamp()), ZoneOffset.UTC);
Map<String, String> diagnosticContext = Collections.unmodifiableMap(iLoggingEvent.getMDCPropertyMap());
List<Map.Entry<String, Object>> keyValuePairs = iLoggingEvent.getKeyValuePairs().stream()
List<Map.Entry<String, Object>> keyValuePairs = iLoggingEvent.getKeyValuePairs() == null ? Collections.emptyList() : iLoggingEvent.getKeyValuePairs().stream()
.map(keyValuePair -> new AbstractMap.SimpleImmutableEntry<>(keyValuePair.key, keyValuePair.value))
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));

Expand Down

0 comments on commit bfc189f

Please sign in to comment.