From ea16c2afff85b7659391f1c418b2272c5a02bd5e Mon Sep 17 00:00:00 2001 From: Marc Strapetz Date: Thu, 16 Jan 2014 16:55:50 +0100 Subject: [PATCH] Fix possible NPE in Repository.resolve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9b19cd90b338a4c3cae5661c658526b7e98c95d1 Signed-off-by: Marc Strapetz ‌ --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 291803ee5..c350dddb2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -384,7 +384,8 @@ public abstract class Repository { try { Object resolved = resolve(rw, revstr); if (resolved instanceof String) { - return getRef((String) resolved).getLeaf().getObjectId(); + final Ref ref = getRef((String)resolved); + return ref != null ? ref.getLeaf().getObjectId() : null; } else { return (ObjectId) resolved; }