From 15c523c443008097736d285677b15ac82882556c Mon Sep 17 00:00:00 2001 From: JJ Brown Date: Mon, 13 Apr 2020 07:55:27 -0500 Subject: [PATCH] Update hamcrest/src/main/java/org/hamcrest/collection/IsMapContaining.java Co-Authored-By: Stephan van Hulst <2323961+nibsi@users.noreply.github.com> --- .../main/java/org/hamcrest/collection/IsMapContaining.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; + } } }