Merge pull request #22421 from olszewskimichal/LinkedMultiValueMap-OutOfBoundException-When-EmptyList

LinkedMultiValueMap.getFirst - check that values is not empty
This commit is contained in:
Juergen Hoeller 2019-05-07 12:44:05 +02:00 committed by GitHub
commit 7e5aacf8a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
@Nullable
public V getFirst(K key) {
List<V> values = this.targetMap.get(key);
return (values != null ? values.get(0) : null);
return (values != null && !values.isEmpty() ? values.get(0) : null);
}
@Override