From: Zhen Chen Date: Wed, 17 Jan 2018 23:14:43 +0000 (-0800) Subject: Skip broken symbolic ref in DfsReftableDatabase X-Git-Tag: v4.11.0.201803080745-r~148 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5452ac1deae00a1dcef9202c8ee5b928a5e70eb9;p=jgit.git 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 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java index 9c844ebe06..40cfb71dde 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java @@ -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); } }