tree-diff: don't access hash of NULL object_id pointer
[gitweb.git] / patch-ids.c
index a70a291d829ee23dde67f2df142f184b0983a70e..9c0ab9e67a80b54f87d9b9d52fa08de7167aec4a 100644 (file)
@@ -17,10 +17,10 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
                return -1;
 
        if (commit->parents)
-               diff_tree_sha1(commit->parents->item->object.oid.hash,
-                              commit->object.oid.hash, "", options);
+               diff_tree_oid(&commit->parents->item->object.oid,
+                             &commit->object.oid, "", options);
        else
-               diff_root_tree_sha1(commit->object.oid.hash, "", options);
+               diff_root_tree_oid(&commit->object.oid, "", options);
        diffcore_std(options);
        return diff_flush_patch_id(options, oid, diff_header_only);
 }