Merge "add null check to patchset object while creating descendent changes." into stable-2.6

This commit is contained in:
Shawn Pearce
2013-04-03 03:59:23 +00:00
committed by Gerrit Code Review

View File

@@ -188,12 +188,25 @@ public class EventFactory {
} }
} }
final RevId revId = db.patchSets().get(psId).getRevision(); final PatchSet ps = db.patchSets().get(psId);
if (ps == null) {
log.error("Error while generating the list of descendants for"
+ " PatchSet " + psId + ": Cannot find PatchSet entry in"
+ " database.");
} else {
final RevId revId = ps.getRevision();
for (PatchSetAncestor a : db.patchSetAncestors().descendantsOf(revId)) { for (PatchSetAncestor a : db.patchSetAncestors().descendantsOf(revId)) {
final PatchSet p = db.patchSets().get(a.getPatchSet()); final PatchSet p = db.patchSets().get(a.getPatchSet());
if (p == null) {
log.error("Error while generating the list of descendants for"
+ " revision " + revId.get() + ": Cannot find PatchSet entry in"
+ " database for " + a.getPatchSet());
continue;
}
final Change c = db.changes().get(p.getId().getParentKey()); final Change c = db.changes().get(p.getId().getParentKey());
ca.neededBy.add(newNeededBy(c, p)); ca.neededBy.add(newNeededBy(c, p));
} }
}
} finally { } finally {
db.close(); db.close();
} }