RSS-190: Fixed nullpointer in addFileAttribute if fileAttribute was manually removed

This commit is contained in:
deiflaender 2022-11-15 13:11:11 +01:00
parent 027b4cd5b3
commit 3aa75c5e91

View File

@ -251,7 +251,7 @@ public class Section {
fileAttributes = new ArrayList<>();
}
boolean exists = fileAttributes.stream().anyMatch(f -> f.getLabel().equals(label) && f.getValue().equals(value));
boolean exists = fileAttributes.stream().anyMatch(f -> f.getLabel() != null && f.getLabel().equals(label) && f.getValue() != null && f.getValue().equals(value));
if (!exists) {
fileAttributes.add(FileAttribute.builder().label(label).value(value).build());
@ -278,7 +278,7 @@ public class Section {
while (matcher.find()) {
String match = matcher.group(group);
if (StringUtils.isNotBlank(match)) {
boolean exists = fileAttributes.stream().anyMatch(f -> f.getLabel().equals(label) && f.getValue().equals(match));
boolean exists = fileAttributes.stream().anyMatch(f -> f.getLabel() != null && f.getLabel().equals(label) && f.getValue() != null && f.getValue().equals(match));
if (!exists) {
fileAttributes.add(FileAttribute.builder().label(label).value(match).build());