Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Delisle2017-02-28 20:17:18 +0000
committerMatthias Sohn2017-02-28 21:43:41 +0000
commit7ac21ccc9faf0ff5fe9952391e311491f6952c53 (patch)
treedd2bfad9062440b37202b2641e919bf023b9b2b4
parent2bc635a8285cf1b6c36abc5fa71bf46990ff176e (diff)
downloadegit-7ac21ccc9faf0ff5fe9952391e311491f6952c53.tar.gz
egit-7ac21ccc9faf0ff5fe9952391e311491f6952c53.tar.xz
egit-7ac21ccc9faf0ff5fe9952391e311491f6952c53.zip
Fix NPE in GitModelSynchronizeParticipant.getPathForResource()
when a resource location returns null. In some situation, when you compare one file and this file references another one in a different repository, an exception is thrown. Example, one Papyrus model that references another one. Change-Id: Ib1031943571c85f98ca88ad1af92e5fc56c3089d Signed-off-by: Simon Delisle <simon.delisle@ericsson.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronizeParticipant.java7
1 files changed, 5 insertions, 2 deletions
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 109d1e0de4..f209f1c693 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
@@ -55,6 +55,7 @@ import org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
@@ -412,8 +413,10 @@ public class GitModelSynchronizeParticipant extends ModelSynchronizeParticipant
return value != null ? value.booleanValue() : defaultValue;
}
- private String getPathForResource(IResource resource) {
- return resource.getLocation().toPortableString();
+ private @Nullable String getPathForResource(IResource resource) {
+ return resource.getLocation() != null
+ ? resource.getLocation().toPortableString()
+ : null;
}
private Set<IResource> getIncludedResources(IMemento memento) {

Back to the top