Skip to contentSkip to conversation

egit.core: Handling mapping unavaiable

PATCH New Shunichi Fuji 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 egit.core: Handling mapping unavaiable

Check whether IResource.getProject returned the workspace root.

---
 .../egit/core/project/RepositoryMapping.java       |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java +5 -2
index 754a172..383cb8b 100644
@@ -267,13 +267,16 @@ public class RepositoryMapping {
 	}
 
 	/**
-	 * Get the repository mappping for a resource
+	 * Get the repository mapping for a resource
 	 *
 	 * @param resource
-	 * @return the RepositoryMapping for this resource
+	 * @return the RepositoryMapping for this resource,
+	 *         or null for non GitProvider.
 	 */
 	public static RepositoryMapping getMapping(IResource resource) {
 		IProject project = resource.getProject();
+		if (project == null)
+			return null;
 		RepositoryProvider provider = RepositoryProvider.getProvider(project);
 		if (!(provider instanceof GitProvider))
 			return null;
Signature · 1 line
1.5.4