{"thread":{"id":"17296","subject":"[EGIT PATCH] Circumvent situations where Eclipse tries to decorate externally linked resources","startedAt":"2009-01-21T22:33:51Z","lastAt":"2009-01-21T22:33:51Z","messageCount":1,"participants":["Charles O'Farrell"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"101470","messageId":"1232577231-3944-1-git-send-email-charleso@charleso.org","threadId":"17296","inReplyTo":null,"subject":"[EGIT PATCH] Circumvent situations where Eclipse tries to decorate externally linked resources","fromName":"Charles O'Farrell","fromEmail":"charleso@charleso.org","sentAt":"2009-01-21T22:33:51Z","receivedAt":"2009-01-21T22:33:51Z","isPatch":true,"sender":{"key":"charleso@charleso.org","avatar":"https://gravatar.com/avatar/ce96d531daa37646a38a81e48113865af86a6d290ad92931f3b217896bdf86ea?d=mp&s=160"},"body":"This occurs in one our projects which has an externally linked folder, which\ncauses the decorator to die on a NPE. Alternatively rsrc.isLinked() could\nhave been used, but we allow for linked resources to repository files.\n\nSigned-off-by: Charles O'Farrell <charleso@charleso.org>\n---\n .../internal/decorators/GitResourceDecorator.java  |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --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\nindex c3ae52d..f24b1eb 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n@@ -296,6 +296,12 @@ public void decorate(final Object element, final IDecoration decoration) {\n \t\t\t\tRepository repository = mapped.getRepository();\n \t\t\t\tGitIndex index = repository.getIndex();\n \t\t\t\tString repoRelativePath = mapped.getRepoRelativePath(rsrc);\n+\n+\t\t\t\tif (repoRelativePath == null) {\n+\t\t\t\t\tActivator.trace(\"Cannot decorate linked resource \" + rsrc);\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n+\n \t\t\t\tTree headTree = repository.mapTree(Constants.HEAD);\n \t\t\t\tTreeEntry blob = headTree!=null ? headTree.findBlobMember(repoRelativePath) : null;\n \t\t\t\tEntry entry = index.getEntry(repoRelativePath);\n-- \n1.6.1.9.g97c34\n"}]}