Match no labels if current patch set is not available

If the current patch set cannot be loaded from ChangeData, assume no
label information. This works around an NPE inside of ChangeControl
where the PatchSet is otherwise required.

Change-Id: If2db5663a931cd8221de75f89e8fbd412e477818
This commit is contained in:
Shawn O. Pearce
2012-08-06 15:01:22 -07:00
parent fba779c7bf
commit 9a147ff332

View File

@@ -349,6 +349,10 @@ public class ListChanges {
}
PatchSet ps = cd.currentPatchSet(db);
if (ps == null) {
return Collections.emptyMap();
}
Map<String, LabelInfo> labels = Maps.newLinkedHashMap();
for (SubmitRecord rec : ctl.canSubmit(db.get(), ps, cd, true, false)) {
if (rec.labels == null) {