diff options
author | Stefan Lay | 2011-03-02 14:49:12 +0000 |
---|---|---|
committer | Stefan Lay | 2011-03-02 14:49:12 +0000 |
commit | dfd74c37c05582408f198aa8fa673e3d62f581ca (patch) | |
tree | 8bc18c1dab7de23f2526e7ce576015401ee16094 /org.eclipse.egit.core | |
parent | 8f9e92c5a4c477a2b6ceb40c72a567f315136076 (diff) | |
download | egit-dfd74c37c05582408f198aa8fa673e3d62f581ca.tar.gz egit-dfd74c37c05582408f198aa8fa673e3d62f581ca.tar.xz egit-dfd74c37c05582408f198aa8fa673e3d62f581ca.zip |
Fix NPE when cloning an empty repository
Bug: 337522
Change-Id: I3ad378139a2daf704364fe82a53c9905e0512108
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.egit.core')
-rw-r--r-- | org.eclipse.egit.core/src/org/eclipse/egit/core/op/CloneOperation.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CloneOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CloneOperation.java index 04ac9a0b2d..a92609daa7 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CloneOperation.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CloneOperation.java @@ -175,7 +175,7 @@ public class CloneOperation { local = new FileRepository(gitdir); local.create(); - if (ref.getName().startsWith(Constants.R_HEADS)) { + if (ref != null && ref.getName().startsWith(Constants.R_HEADS)) { final RefUpdate head = local.updateRef(Constants.HEAD); head.disableRefLog(); head.link(ref.getName()); @@ -207,7 +207,7 @@ public class CloneOperation { // branch is like 'Constants.R_HEADS + branchName', we need only // the 'branchName' part - if (ref.getName().startsWith(Constants.R_HEADS)) { + if (ref != null && ref.getName().startsWith(Constants.R_HEADS)) { String branchName = ref.getName().substring(Constants.R_HEADS.length()); // setup the default remote branch for branchName @@ -233,6 +233,8 @@ public class CloneOperation { } private void doCheckout(final IProgressMonitor monitor) throws IOException { + if (ref == null) + return; final Ref head = fetchResult.getAdvertisedRef(ref.getName()); if (head == null || head.getObjectId() == null) return; |