diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2010-10-15 14:51:52 +0200 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2010-10-18 00:19:13 +0200 |
commit | 609c6dc3580653516038b4d677bfb2e735fd641f (patch) | |
tree | 9ab550243a97737229b519e4854438cc371a6b66 | |
parent | 9b4876cedf430e454b99da5410e2a9d624f35129 (diff) | |
download | jgit-609c6dc3580653516038b4d677bfb2e735fd641f.tar.gz jgit-609c6dc3580653516038b4d677bfb2e735fd641f.zip |
Fix possible NPE in DirCacheCheckout
There was a chance that we hit a NPE which doing a checkout
with DirCacheCheckout when there is no HEAD (e.g. initial
checkout). This is fixed here.
Change-Id: Ie3b8cae21dcd90ba8352823ea94a700f8ee9221a
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index eb7c9e1202..03d2b8e9c8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -280,10 +280,13 @@ public class DirCacheCheckout { if (walk.isDirectoryFileConflict()) { conflicts.add(walk.getPathString()); } else { - // ... and the working dir contained a file or folder -> - // add it to the removed set and remove it from conflicts set - remove(i.getEntryPathString()); - conflicts.remove(i.getEntryPathString()); + if (i != null) { + // ... and the working dir contained a file or folder -> + // add it to the removed set and remove it from + // conflicts set + remove(i.getEntryPathString()); + conflicts.remove(i.getEntryPathString()); + } } } else keep(i.getDirCacheEntry()); |