]> source.dussan.org Git - jgit.git/commitdiff
Skip broken symbolic ref in DfsReftableDatabase 75/115575/1
authorZhen Chen <czhen@google.com>
Wed, 17 Jan 2018 23:14:43 +0000 (15:14 -0800)
committerZhen Chen <czhen@google.com>
Wed, 17 Jan 2018 23:19:05 +0000 (15:19 -0800)
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>
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java

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