Skip to content

Commit

Permalink
[Fixes #529] Prevent NPE when context map is null
Browse files Browse the repository at this point in the history
(cherry picked from commit c7a831315f8b48cbde6c2fb3564e0f6267303c6e)
  • Loading branch information
grgrzybek authored and HeshanSudarshana committed Mar 1, 2024
1 parent a447ca1 commit eba76c6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.ops4j.pax.logging.slf4j;

import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -88,6 +89,9 @@ public void clear() {
public Map<String, String> getCopyOfContextMap() {
Map<String, Object> copy = getContext().getCopyOfContextMap();
Map<String, String> result = new HashMap<>();
if (copy == null) {
return Collections.emptyMap();
}
copy.forEach((k, v) -> {
if (v instanceof String) {
result.put(k, (String) v);
Expand Down

0 comments on commit eba76c6

Please sign in to comment.