Commit Diff


commit - f71823372787764c1a09b0b2a3515dd41b077f2d
commit + b74c76254a0262d7eca704ebdb9e3bbb1d6fecb2
blob - f0adc78ea7549c48ef078033c86f8e80e13d9db3
blob + 6d774945f4b0453d42901b53c79698525b6932f9
--- lib/diff.c
+++ lib/diff.c
@@ -447,6 +447,9 @@ got_diff_objects_as_blobs(struct got_object *obj1, str
 {
 	const struct got_error *err;
 	struct got_blob_object *blob1 = NULL, *blob2 = NULL;
+
+	if (obj1 == NULL && obj2 == NULL)
+		return got_error(GOT_ERR_NO_OBJ);
 
 	if (obj1) {
 		err = got_object_blob_open(&blob1, repo, obj1, 8192);
@@ -474,6 +477,9 @@ got_diff_objects_as_trees(struct got_object *obj1, str
 	const struct got_error *err;
 	struct got_tree_object *tree1 = NULL, *tree2 = NULL;
 
+	if (obj1 == NULL && obj2 == NULL)
+		return got_error(GOT_ERR_NO_OBJ);
+
 	if (obj1) {
 		err = got_object_tree_open(&tree1, repo, obj1);
 		if (err)
@@ -501,6 +507,9 @@ got_diff_objects_as_commits(struct got_object *obj1, s
 	struct got_commit_object *commit1 = NULL, *commit2 = NULL;
 	struct got_object *tree_obj1  = NULL, *tree_obj2 = NULL;
 
+	if (obj1 == NULL && obj2 == NULL)
+		return got_error(GOT_ERR_NO_OBJ);
+
 	if (obj1) {
 		err = got_object_commit_open(&commit1, repo, obj1);
 		if (err)