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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We crashed because the right side did not contain any information

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---

 .../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 "";
 		}
 	}
 

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]