diff --git a/diff-lib.c b/diff-lib.c
index 9c29293bbc05d175ba13338813e8532c7ad677cf..fd61acbdce8c65f5146b15af0ab322501f271794 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
if (cached && idx && ce_stage(idx)) {
struct diff_filepair *pair;
pair = diff_unmerge(&revs->diffopt, idx->name);
- fill_filespec(pair->one, idx->sha1, idx->ce_mode);
+ if (tree)
+ fill_filespec(pair->one, tree->sha1, tree->ce_mode);
return;
}