Skip to content

Commit

Permalink
attributeValue NPE handling
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam authored and jansupol committed Sep 24, 2020
1 parent f8ae767 commit d19ed01
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -173,10 +173,15 @@ public void setAttribute(Attribute attribute)

@Override
public AttributeList getAttributes(String[] attributes) {
AttributeList x = new AttributeList();
for (String k : attributes) {
Attribute a = new Attribute(k, attributeValues.get(k).get());
x.add(a);
final AttributeList x = new AttributeList();
if (attributes == null) {
return x;
}
for (final String k : attributes) {
final Value<?> value = attributeValues.get(k);
if (value != null) {
x.add(new Attribute(k, value.get()));
}
}
return x;
}
Expand Down

0 comments on commit d19ed01

Please sign in to comment.