egit.core: Handling mapping unavaiable
PATCH 1/1 egit.core: Handling mapping unavaiable
Check whether IResource.getProject returned the workspace root.
Signed-off-by Shunichi Fuji <[email protected]>
--- .../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
@@ -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