Fixed NoSuchElementException in renderChangeInfo

Add check for null when getting the label.maxValue(). In case the
label values set is empty then the permittedVotingRange().max()
will not be considered for the UI tooltip.

Change-Id: Id6ef28d5ed903babd2281aa6ab992e018d663b38
This commit is contained in:
Oleg Aravin 2016-12-12 17:52:17 -08:00
parent ee6774fce4
commit 1a8d78d334

View File

@ -255,7 +255,9 @@ public class Reviewers extends Composite {
Map<Integer, VotableInfo> d = new HashMap<>();
for (String name : change.labels()) {
LabelInfo label = change.label(name);
short labelMaxValue = LabelInfo.parseValue(label.maxValue());
Short labelMaxValue = label.valueSet().isEmpty()
? null
: LabelInfo.parseValue(label.maxValue());
if (label.all() != null) {
for (ApprovalInfo ai : Natives.asList(label.all())) {
int id = ai._accountId();
@ -264,7 +266,8 @@ public class Reviewers extends Composite {
ad = new VotableInfo();
d.put(id, ad);
}
if (ai.permittedVotingRange() != null
if (labelMaxValue != null
&& ai.permittedVotingRange() != null
&& ai.permittedVotingRange().max() == labelMaxValue) {
ad.votable(name + " (" + label.maxValue() + ") ");
} else if (ai.hasValue()) {