Always return labels object if requested for changes

A change can get into a state where it has no revisions if initially
created as a draft and the owner deletes the draft patch sets. Such
changes block dashboards from displaying because the labels object
was not being output to the client, even though the client expected
it to appear.

Always produce an empty labels object if either standard or detailed
label type was requested by the caller. This ensures the object
exists in the client, avoiding a lookup on 'undefined'.

Change-Id: If620ebd50c9a52d15fb627b4d6593c491f1ba9e4
This commit is contained in:
Shawn Pearce
2013-07-18 11:05:58 -07:00
parent 3a2a2471b5
commit 91c8bc01e8

View File

@@ -351,11 +351,6 @@ public class ChangeJson {
return null;
}
PatchSet ps = cd.currentPatchSet(db);
if (ps == null) {
return null;
}
LabelTypes labelTypes = ctl.getLabelTypes();
if (cd.getChange().getStatus().isOpen()) {
return labelsForOpenChange(cd, labelTypes, standard, detailed);