From 60a7909fca4ed31355f70b4838f1772bc57bb7e2 Mon Sep 17 00:00:00 2001 From: olszewskimichal Date: Sat, 16 Feb 2019 11:55:23 +0100 Subject: [PATCH] getFirst - check that values is not empty --- .../main/java/org/springframework/util/LinkedMultiValueMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/util/LinkedMultiValueMap.java b/spring-core/src/main/java/org/springframework/util/LinkedMultiValueMap.java index 7dd97af0f3..3b2ca0f3e7 100644 --- a/spring-core/src/main/java/org/springframework/util/LinkedMultiValueMap.java +++ b/spring-core/src/main/java/org/springframework/util/LinkedMultiValueMap.java @@ -81,7 +81,7 @@ public class LinkedMultiValueMap implements MultiValueMap, Serializa @Nullable public V getFirst(K key) { List values = this.targetMap.get(key); - return (values != null ? values.get(0) : null); + return (values != null && !values.isEmpty() ? values.get(0) : null); } @Override