]> source.dussan.org Git - jgit.git/commitdiff
Fix null ref exception in DirCacheCheckout 77/1877/1
authorLluis Sanchez <slluis.devel@gmail.com>
Wed, 10 Nov 2010 09:39:48 +0000 (10:39 +0100)
committerLluis Sanchez <slluis.devel@gmail.com>
Wed, 10 Nov 2010 09:56:46 +0000 (10:56 +0100)
Added missing null check for getDirCacheEntry(). This method may
return null for example if the curernt entry is a subtree.

org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

index 5b71dc091fc22c4df3edb383dddd1e8884a5856e..bc51aa55a28c39f956de39262268cc1e0a27392f 100644 (file)
@@ -274,8 +274,9 @@ public class DirCacheCheckout {
                        WorkingTreeIterator f) {
                if (m != null) {
                        if (i == null || f == null || !m.idEqual(i)
-                                       || f.isModified(i.getDirCacheEntry(), true,
-                                                       config_filemode(), repo.getFS())) {
+                                       || (i.getDirCacheEntry() != null && f.isModified(i
+                                                       .getDirCacheEntry(), true, config_filemode(), repo
+                                                       .getFS()))) {
                                update(m.getEntryPathString(), m.getEntryObjectId(),
                                                m.getEntryFileMode());
                        } else