From 0a360cf71547dcc648c2f287dbc692b896d4385c Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Mon, 2 Jul 2007 00:35:26 +0200 Subject: [PATCH] Handle commit without message In particular 7b7abfe3dd81d659a0889f88965168f7eef8c5c6 in the Linux kernel, has no message attached Signed-off-by: Robin Rosenberg --- org.spearce.jgit/src/org/spearce/jgit/lib/Commit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Commit.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Commit.java index be51b303..6d69098a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/Commit.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Commit.java @@ -193,7 +193,7 @@ public class Commit implements Treeish { } byte[] readBuf = new byte[br.available()]; // in-memory stream so this is all bytes left br.read(readBuf); - int msgstart = readBuf[0] == '\n' ? 1 : 0; + int msgstart = readBuf.length != 0 ? ( readBuf[0] == '\n' ? 1 : 0 ) : 0; if (encoding != null) { // TODO: this isn't reliable so we need to guess the encoding from the actual content -- 2.11.4.GIT