diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java index f4f79f3e..2b15cd4e 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java @@ -94,7 +94,11 @@ public IsMapContainingEntry(K key, V value) @Override public boolean matchesSafely(Map map) { - return map.containsKey(key) && super.valueMatcher.matches(map.get(key)); + try { + return map.containsKey(key) && super.valueMatcher.matches(map.get(key)); + catch (NullPointerException ex) { + return false; + } } }