[EGIT PATCH] Circumvent situations where Eclipse tries to decorate externally linked resources

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

 



This occurs in one our projects which has an externally linked folder, which
causes the decorator to die on a NPE. Alternatively rsrc.isLinked() could
have been used, but we allow for linked resources to repository files.

Signed-off-by: Charles O'Farrell <charleso@xxxxxxxxxxxx>
---
 .../internal/decorators/GitResourceDecorator.java  |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
index c3ae52d..f24b1eb 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
@@ -296,6 +296,12 @@ public void decorate(final Object element, final IDecoration decoration) {
 				Repository repository = mapped.getRepository();
 				GitIndex index = repository.getIndex();
 				String repoRelativePath = mapped.getRepoRelativePath(rsrc);
+
+				if (repoRelativePath == null) {
+					Activator.trace("Cannot decorate linked resource " + rsrc);
+					return;
+				}
+
 				Tree headTree = repository.mapTree(Constants.HEAD);
 				TreeEntry blob = headTree!=null ? headTree.findBlobMember(repoRelativePath) : null;
 				Entry entry = index.getEntry(repoRelativePath);
-- 
1.6.1.9.g97c34

--
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