From ee47bb617b316185cccb59d2775bdf7db65a74e5 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Tue, 21 Aug 2007 23:25:23 +0200 Subject: [PATCH] Do not crash if the repo does not have a pack Signed-off-by: Robin Rosenberg --- org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java index 297f91f1..6c3383b6 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java @@ -452,12 +452,14 @@ public class Repository { && idx.canRead(); } }); - for (int k = 0; k < list.length; k++) { - try { - packList.add(new PackFile(this, list[k])); - } catch (IOException ioe) { - // Whoops. That's not a pack! - // + if (list != null) { + for (int k = 0; k < list.length; k++) { + try { + packList.add(new PackFile(this, list[k])); + } catch (IOException ioe) { + // Whoops. That's not a pack! + // + } } } } -- 2.11.4.GIT