git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel Cheng (aka SDiZ)" <j16sdiz+freenet@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>,
	Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org, "Daniel Cheng (aka SDiZ)" <git@sdiz.net>
Subject: [PATCH EGIT] Fix NPE on missing git data
Date: Thu, 30 Apr 2009 22:59:22 +0800	[thread overview]
Message-ID: <1241103562-6658-1-git-send-email-git@sdiz.net> (raw)

Fix the following NPE:
!ENTRY org.eclipse.core.resources 4 2 2009-04-30 22:52:47.117
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
    at org.spearce.egit.core.project.RepositoryMapping.getMapping(RepositoryMapping.java:235)
    at org.spearce.egit.ui.internal.decorators.GitLightweightDecorator$2.visit(GitLightweightDecorator.java:492)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:55)
    at org.spearce.egit.ui.internal.decorators.GitLightweightDecorator.resourceChanged(GitLightweightDecorator.java:477)
    at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:288)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
    at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:282)
    at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:148)
    at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:313)
    at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1022)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Signed-off-by: Daniel Cheng (aka SDiZ) <git@sdiz.net>
---
 .../egit/core/project/RepositoryMapping.java       |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
index b49f380..029c56a 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
@@ -232,6 +232,9 @@ public static RepositoryMapping getMapping(final IResource resource) {
 		if (!(rp instanceof GitProvider))
 			return null;
 
+		if (((GitProvider)rp).getData() == null)
+			return null;
+
 		return ((GitProvider)rp).getData().getRepositoryMapping(resource);
 	}
 
-- 
1.6.2.1

                 reply	other threads:[~2009-04-30 14:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1241103562-6658-1-git-send-email-git@sdiz.net \
    --to=j16sdiz+freenet@gmail.com \
    --cc=git@sdiz.net \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).