[EGIT PATCH] egit.core: Handling mapping unavaiable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 Check whether IResource.getProject returned the workspace root.

Signed-off-by: Shunichi Fuji <palglowr@xxxxxxxxx>
---
 .../egit/core/project/RepositoryMapping.java       |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
index 754a172..383cb8b 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
@@ -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;
-- 
1.5.4

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux