Commit Diff


commit - f47e2be5099a39b598f7b96d26b4fa08fdb62374
commit + 6ed9ffec8b7318ac6f69a138854afefc48bca2c0
blob - 00b76714868599ae292351b665e7a84bbeb85b81
blob + 7850a8a50fe8ff23c3f0d68ab713639f97d85090
--- tog/tog.c
+++ tog/tog.c
@@ -4472,8 +4472,10 @@ cmd_log(int argc, char *argv[])
 
 	if (repo_path == NULL) {
 		cwd = getcwd(NULL, 0);
-		if (cwd == NULL)
-			return got_error_from_errno("getcwd");
+		if (cwd == NULL) {
+			error = got_error_from_errno("getcwd");
+			goto done;
+		}
 		error = got_worktree_open(&worktree, cwd, NULL);
 		if (error && error->code != GOT_ERR_NOT_WORKTREE)
 			goto done;