Fix possible NPE when auto-closing changes
Before [1] all refs in existingRefs were guaranteed to be patchset refs, whereas the refs taken from ReceivePackRefsCache are all refs in the "refs/changes/*" namespace and these aren't guaranteed to be patchset refs. While walking the commits from new tip to previous tip to find open changes that should be closed by the push, possible patchset-refs are collected from ReceivePackRefsCache. Check if the found refs actually are patchset-refs before attempting to parse it into a Patchset.Id. [1] https://gerrit-review.googlesource.com/c/gerrit/+/241932 Bug: Issue 13408 Change-Id: Ifafdbba79c436ced406914937ba259eccea7c84f
This commit is contained in:
committed by
Luca Milanesio
parent
d6aff75bbb
commit
46106cdb2b
@@ -3272,6 +3272,9 @@ class ReceiveCommits {
|
||||
|
||||
for (Ref ref :
|
||||
receivePackRefCache.tipsFromObjectId(c.copy(), RefNames.REFS_CHANGES)) {
|
||||
if (!PatchSet.isChangeRef(ref.getName())) {
|
||||
continue;
|
||||
}
|
||||
PatchSet.Id psId = PatchSet.Id.fromRef(ref.getName());
|
||||
Optional<ChangeNotes> notes = getChangeNotes(psId.changeId());
|
||||
if (notes.isPresent() && notes.get().getChange().getDest().equals(branch)) {
|
||||
|
||||
Reference in New Issue
Block a user