DORMANTno replies

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

From: Charles O'Farrell <hidden>
Date: 2016-06-15 22:46:00
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 .../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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help