git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH 04/10] Bug: Do not crash when showing diff for first version of a file

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
May 7, 2007, 21:29 UTC
Message-ID
<20070507212933.21546.44917.stgit@lathund.dewire.com>
In-Reply-To
<20070507212636.21546.29280.stgit@lathund.dewire.com>
We crashed because the right side did not contain any information
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../spearce/egit/ui/internal/GitResourceNode.java  |   28 ++++++++++++++---------
 1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
index bdf8902..010b738 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/GitResourceNode.java
@@ -70,7 +70,10 @@ public class GitResourceNode extends BufferedContent implements IStructureCompar
 	}
 
 	public String getName() {
-		return entry.getFullName();
+		if (entry != null)
+			return entry.getFullName();
+		else
+			return "<none>";
 	}
 
 	public Image getImage() {
@@ -81,16 +84,19 @@ public class GitResourceNode extends BufferedContent implements IStructureCompar
 		if (entry instanceof Tree)
 			return ITypedElement.FOLDER_TYPE;
 		else {
-			String name = entry.getName();
-			if (name != null) {
-				int index = name.lastIndexOf('.');
-				if (index == -1)
-					return ""; //$NON-NLS-1$
-				if (index == (name.length() - 1))
-					return ""; //$NON-NLS-1$
-				return name.substring(index + 1);
-			}
-			return "";
+			if (entry != null) {
+				String name = entry.getName();
+				if (name != null) {
+					int index = name.lastIndexOf('.');
+					if (index == -1)
+						return ""; //$NON-NLS-1$
+					if (index == (name.length() - 1))
+						return ""; //$NON-NLS-1$
+					return name.substring(index + 1);
+				}
+				return "";
+			} else
+				return "";
 		}
 	}
 
Previous: Robin RosenbergNext: Robin Rosenberg
Message 5 of 14 in “[EGIT 00/10] This weeks Eclipse patches”
  1. Robin RosenbergMay 7, 2007
  2. 01/10 Fixes due to changes in the Eclipse Team APIRobin Rosenberg, May 7, 2007
  3. 02/10 Recursion and update of all elements regardless of need.Robin Rosenberg, May 7, 2007
  4. 03/10 Update compare window immediatelyRobin Rosenberg, May 7, 2007
  5. 04/10 Bug: Do not crash when showing diff for first version of a fileRobin Rosenberg, May 7, 2007
  6. 05/10 Speed up ObjectId a little.Robin Rosenberg, May 7, 2007
  7. 06/10 Create a generic history walkerRobin Rosenberg, May 7, 2007
  8. 07/10 Cache pack index fullyRobin Rosenberg, May 7, 2007
  9. 08/10 Use ObjectId[] instead of List for parentsRobin Rosenberg, May 7, 2007
  10. 09/10 Run history refresh in backgroundRobin Rosenberg, May 7, 2007
  11. 10/10 Enable a tooltip in the history viewRobin Rosenberg, May 7, 2007
  12. Eclipse support status (was: Re: [EGIT 00/10] This weeks Eclipse patches)Grzegorz Kulewski, May 7, 2007
  13. Shawn O. PearceMay 8, 2007
  14. Shawn O. PearceMay 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.