Commit Diff


commit - 93a3027739b17cdd9bccd7bda53f581b919b87ea
commit + 4acef5eedd5863726d7d94dde5b8e8beb13aeaf2
blob - e6c12b6914a3e45988975730c905d96a0b10cd33
blob + b0703633acb2df162d43ba43b5552e4bfe34efce
--- tog/tog.c
+++ tog/tog.c
@@ -1227,14 +1227,14 @@ open_diff_view_for_commit(struct tog_view **new_view, 
 	const struct got_error *err;
 	struct got_object_qid *parent_id;
 	struct tog_view *diff_view;
-
-	parent_id = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
 
 	diff_view = view_open(0, 0, 0, begin_x, TOG_VIEW_DIFF);
 	if (diff_view == NULL)
 		return got_error_from_errno();
 
-	err = open_diff_view(diff_view, parent_id->id, commit_id, repo);
+	parent_id = SIMPLEQ_FIRST(got_object_commit_get_parent_ids(commit));
+	err = open_diff_view(diff_view, parent_id ? parent_id->id : NULL,
+	    commit_id, repo);
 	if (err == NULL)
 		*new_view = diff_view;
 	return err;