summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorPhilipp Thun2011-03-28 11:54:24 (EDT)
committer Philipp Thun2011-03-28 11:54:24 (EDT)
commit475672866a15ff325583e9ccadd9d606d8b66384 (patch)
tree9d8d631b11c643c916e0afcdf847f8fe20a14ce9
parent23967441fc5b72996f5f29e197d52e763a14cb32 (diff)
downloadjgit-475672866a15ff325583e9ccadd9d606d8b66384.zip
jgit-475672866a15ff325583e9ccadd9d606d8b66384.tar.gz
jgit-475672866a15ff325583e9ccadd9d606d8b66384.tar.bz2
Fix possible NPE in DirCache.isModified()refs/changes/51/2951/1
The snapshot field of a DirCache object for a newly created repository can be null. This fix prevents a NPE when isModified() is called in such a situation. Change-Id: I61a1b45db2d60fdcc0f87373ac6fd75ac4c4a202 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 0d8fb7e..96173b7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -321,7 +321,7 @@ public class DirCache {
public boolean isOutdated() throws IOException {
if (liveFile == null || !liveFile.exists())
return false;
- return snapshot.isModified(liveFile);
+ return snapshot != null && snapshot.isModified(liveFile);
}
/** Empty this index, removing all entries. */