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>
This commit is contained in:
Christian Halstrick 2010-10-15 14:51:52 +02:00
parent 9b4876cedf
commit 609c6dc358
1 changed files with 7 additions and 4 deletions

View File

@ -280,10 +280,13 @@ void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i,
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());