Skip to content

Commit 15c523c

Browse files
Update hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java
Co-Authored-By: Stephan van Hulst <[email protected]>
1 parent 7e26e11 commit 15c523c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ public IsMapContainingEntry(K key, V value)
9494
@Override
9595
public boolean matchesSafely(Map<? extends K, ? extends V> map)
9696
{
97-
return map.containsKey(key) && super.valueMatcher.matches(map.get(key));
97+
try {
98+
return map.containsKey(key) && super.valueMatcher.matches(map.get(key));
99+
catch (NullPointerException ex) {
100+
return false;
101+
}
98102
}
99103
}
100104

0 commit comments

Comments
 (0)