From: Marc Strapetz Date: Thu, 16 Jan 2014 15:55:50 +0000 (+0100) Subject: Fix possible NPE in Repository.resolve X-Git-Tag: v3.4.0.201405051725-m7~75 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F22462%2F1;p=jgit.git Fix possible NPE in Repository.resolve Change-Id: I9b19cd90b338a4c3cae5661c658526b7e98c95d1 Signed-off-by: Marc Strapetz ‌ --- 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 291803ee59..c350dddb25 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; }