Skip to content

Commit

Permalink
Merge pull request #10 from HeshanSudarshana/main-add-NPE-fix
Browse files Browse the repository at this point in the history
[Fixes #529] Prevent NPE when context map is null
  • Loading branch information
HeshanSudarshana authored Mar 1, 2024
2 parents a447ca1 + eba76c6 commit d6b30af
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 d6b30af

Please sign in to comment.