From 5452ac1deae00a1dcef9202c8ee5b928a5e70eb9 Mon Sep 17 00:00:00 2001 From: Zhen Chen Date: Wed, 17 Jan 2018 15:14:43 -0800 Subject: [PATCH] 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 --- .../eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } } -- 2.39.5