summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Strapetz <marc.strapetz@syntevo.com>2014-01-16 16:55:50 +0100
committerMarc Strapetz <marc.strapetz@syntevo.com>2014-02-24 18:39:38 +0100
commitea16c2afff85b7659391f1c418b2272c5a02bd5e (patch)
treec41bbcb560ebe50ec3d7af1fe2249f1032bbd7bf
parent8e0e78858c27b86cd0f04603e122fa69909c0299 (diff)
downloadjgit-ea16c2afff85b7659391f1c418b2272c5a02bd5e.tar.gz
jgit-ea16c2afff85b7659391f1c418b2272c5a02bd5e.zip
Fix possible NPE in Repository.resolve
Change-Id: I9b19cd90b338a4c3cae5661c658526b7e98c95d1 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java3
1 files changed, 2 insertions, 1 deletions
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;
}