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
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
index ba182d2..fc99201 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
@@ -1093,14 +1093,15 @@
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);