Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-05-27 15:19:17 -0400
committerGerrit Code Review @ Eclipse.org2013-05-28 05:30:15 -0400
commit90b3969cd9afebd15ceb8ba592ddf01aeaeca051 (patch)
tree5177d9a1369b26f51bdb61ad469e530daff5d41f
parenta833fd75c3fccf200f94fb4fb555b53568fae15a (diff)
downloadegit-90b3969cd9afebd15ceb8ba592ddf01aeaeca051.tar.gz
egit-90b3969cd9afebd15ceb8ba592ddf01aeaeca051.tar.xz
egit-90b3969cd9afebd15ceb8ba592ddf01aeaeca051.zip
[sync] Fix NPE when restoring sync data of unshared project
Also document that GitProjectData.get may return null. Bug: 367010 Change-Id: I20e4342f5b351d759bd7fcee9ec5f743d3a2a61c
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java2
2 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
index 680c4dedb2..2106cc336f 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/project/GitProjectData.java
@@ -191,7 +191,9 @@ public class GitProjectData {
/**
* @param p
- * @return {@link GitProjectData} for the specified project
+ * @return {@link GitProjectData} for the specified project, or null if the
+ * Git provider is not associated with the project or an exception
+ * occurred
*/
public synchronized static GitProjectData get(final IProject p) {
try {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
index 93056b574a..569e1252dd 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java
@@ -386,6 +386,8 @@ public class GitModelSynchronizeParticipant extends ModelSynchronizeParticipant
IContainer mappedContainer = ResourcesPlugin.getWorkspace().getRoot()
.getContainerForLocation(path);
GitProjectData projectData = GitProjectData.get((IProject) mappedContainer);
+ if (projectData == null)
+ return null;
RepositoryMapping mapping = projectData.getRepositoryMapping(mappedContainer);
if (mapping != null)
return mapping.getRepository();

Back to the top