From 00987d1b8fde609525c12b44f51727ab619f52c2 Mon Sep 17 00:00:00 2001 From: Charles O'Farrell Date: Thu, 22 Jan 2009 08:33:51 +1000 Subject: [PATCH] Circumvent situations where Eclipse tries to decorate externally linked resources 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 Signed-off-by: Robin Rosenberg --- .../spearce/egit/ui/internal/decorators/GitResourceDecorator.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 c3ae52da..f24b1eb5 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 class GitResourceDecorator extends LabelProvider implements 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); -- 2.11.4.GIT