aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Strapetz2014-01-16 10:55:50 (EST)
committerMarc Strapetz2014-02-24 12:39:38 (EST)
commitea16c2afff85b7659391f1c418b2272c5a02bd5e (patch)
treec41bbcb560ebe50ec3d7af1fe2249f1032bbd7bf
parent8e0e78858c27b86cd0f04603e122fa69909c0299 (diff)
downloadjgit-ea16c2afff85b7659391f1c418b2272c5a02bd5e.zip
jgit-ea16c2afff85b7659391f1c418b2272c5a02bd5e.tar.gz
jgit-ea16c2afff85b7659391f1c418b2272c5a02bd5e.tar.bz2
Fix possible NPE in Repository.resolverefs/changes/62/22462/1
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 291803e..c350ddd 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;
}