Browse Source

Skip broken symbolic ref in DfsReftableDatabase

We skipped the broken symbolic reference in other implementation like
DfsRefDatabase, RefDirectory. The broken symbolic reference may cause
NPE when caller forget to have a null check against the object id before
calling parse it.

Change-Id: If5e07202e9ee329d0bd9488936d79c98143c7ad9
Signed-off-by: Zhen Chen <czhen@google.com>
stable-4.11
Zhen Chen 7 years ago
parent
commit
5452ac1dea
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java

@ -241,7 +241,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
: table.seekRef(prefix)) { : table.seekRef(prefix)) {
while (rc.next()) { while (rc.next()) {
Ref ref = table.resolve(rc.getRef()); Ref ref = table.resolve(rc.getRef());
if (ref != null) { if (ref != null && ref.getObjectId() != null) {
all.add(ref); all.add(ref);
} }
} }

Loading…
Cancel
Save