Fix potential NPE in queries with --dependencies (descendants)

If an entry in patch_set_ancestors references a non-existing
entry in the change table, an NPE would be thrown and the query
would be aborted.  Instead, skip over that entry so the query
still works.

Change-Id: I985c0d0aec926e991eb3b140186c7de0f598b7ea
This commit is contained in:
Martin Fick
2014-04-18 13:56:20 -06:00
parent 683390f7f9
commit f9fe003d47

View File

@@ -261,6 +261,12 @@ public class EventFactory {
continue;
}
final Change c = db.changes().get(p.getId().getParentKey());
if (c == null) {
log.error("Error while generating the list of descendants for"
+ " revision " + revId.get() + ": Cannot find Change entry in"
+ " database for " + p.getId().getParentKey());
continue;
}
ca.neededBy.add(newNeededBy(c, p));
}
}