Quellcode durchsuchen

Fix possible NPE in DirCache.isModified()

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>
tags/v0.12.1
Philipp Thun vor 13 Jahren
Ursprung
Commit
475672866a
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1
    1
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java Datei anzeigen

@@ -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. */

Laden…
Abbrechen
Speichern