Merge "Add undefined check to revision-info"
This commit is contained in:
@@ -35,6 +35,9 @@ limitations under the License.
|
||||
* @return {Number}
|
||||
*/
|
||||
RevisionInfo.prototype.getMaxParents = function() {
|
||||
if (!this._change || !this._change.revisions) {
|
||||
return 0;
|
||||
}
|
||||
return Object.values(this._change.revisions)
|
||||
.reduce((acc, rev) => Math.max(rev.commit.parents.length, acc), 0);
|
||||
};
|
||||
@@ -46,6 +49,9 @@ limitations under the License.
|
||||
*/
|
||||
RevisionInfo.prototype.getParentCountMap = function() {
|
||||
const result = {};
|
||||
if (!this._change || !this._change.revisions) {
|
||||
return {};
|
||||
}
|
||||
Object.values(this._change.revisions)
|
||||
.forEach(rev => { result[rev._number] = rev.commit.parents.length; });
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user