Browse Source

Fix possible NPE in Repository.resolve

Change-Id: I9b19cd90b338a4c3cae5661c658526b7e98c95d1
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
stable-3.4
Marc Strapetz 11 years ago
parent
commit
ea16c2afff
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

@ -384,7 +384,8 @@ public abstract class Repository {
try { try {
Object resolved = resolve(rw, revstr); Object resolved = resolve(rw, revstr);
if (resolved instanceof String) { if (resolved instanceof String) {
return getRef((String) resolved).getLeaf().getObjectId(); final Ref ref = getRef((String)resolved);
return ref != null ? ref.getLeaf().getObjectId() : null;
} else { } else {
return (ObjectId) resolved; return (ObjectId) resolved;
} }

Loading…
Cancel
Save