ChangeData#isReviewedBy: Guard against null current patch set

If the change has been deleted, the current patch set is null, which
results in failure to dispatch the change-deleted event (introduced
on stable-2.14 and will be brought to stable-2.15 by merge), in turn
resulting in all of the change deletion integration tests failing.

Change-Id: I0e703b479539e255a6164f329bd9aff6feecc366
This commit is contained in:
David Pursehouse 2018-09-15 16:45:21 +09:00
parent d360c38803
commit 73e294301c
1 changed files with 8 additions and 7 deletions

View File

@ -1093,14 +1093,15 @@ public class ChangeData {
public boolean isReviewedBy(Account.Id accountId) throws OrmException {
Collection<String> stars = stars(accountId);
if (stars.contains(
StarredChangesUtil.REVIEWED_LABEL + "/" + currentPatchSet().getPatchSetId())) {
return true;
}
PatchSet ps = currentPatchSet();
if (ps != null) {
if (stars.contains(StarredChangesUtil.REVIEWED_LABEL + "/" + ps.getPatchSetId())) {
return true;
}
if (stars.contains(
StarredChangesUtil.UNREVIEWED_LABEL + "/" + currentPatchSet().getPatchSetId())) {
return false;
if (stars.contains(StarredChangesUtil.UNREVIEWED_LABEL + "/" + ps.getPatchSetId())) {
return false;
}
}
return reviewedBy().contains(accountId);