Fix IndexOutOfBoundsException in FormField.getFirstValue()

Fixes SMACK-838.
This commit is contained in:
Florian Schmaus 2018-10-14 12:07:51 +02:00
parent 89c9a41863
commit ec982f65e2
1 changed files with 5 additions and 3 deletions

View File

@ -261,12 +261,14 @@ public class FormField implements NamedElement {
*/ */
public String getFirstValue() { public String getFirstValue() {
CharSequence firstValue; CharSequence firstValue;
synchronized (values) { synchronized (values) {
if (values.isEmpty()) {
return null;
}
firstValue = values.get(0); firstValue = values.get(0);
} }
if (firstValue == null) {
return null;
}
return firstValue.toString(); return firstValue.toString();
} }