Commit b55e96cf8f2e45d9a12689ad41d08d426e9715a5

Martin Pieuchot 2020-01-19T14:35:58

Remove redundant error check after got_object_id_by_path(). An error code is always returned when the oid is NULL.

diff --git a/got/got.c b/got/got.c
index c053c61..6b7a4b5 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2640,10 +2640,6 @@ cmd_blame(int argc, char *argv[])
 	error = got_object_id_by_path(&obj_id, repo, commit_id, in_repo_path);
 	if (error)
 		goto done;
-	if (obj_id == NULL) {
-		error = got_error(GOT_ERR_NO_OBJ);
-		goto done;
-	}
 
 	error = got_object_get_type(&obj_type, repo, obj_id);
 	if (error)
diff --git a/tog/tog.c b/tog/tog.c
index 29fe345..6872cd3 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -3635,8 +3635,6 @@ run_blame(struct tog_blame *blame, struct tog_view *view, int *blame_complete,
 	err = got_object_id_by_path(&obj_id, repo, commit_id, path);
 	if (err)
 		return err;
-	if (obj_id == NULL)
-		return got_error(GOT_ERR_NO_OBJ);
 
 	err = got_object_get_type(&obj_type, repo, obj_id);
 	if (err)