Commit Diff


commit - 58041363b15268c10af599e8fde0065ad975f554
commit + 5a5defb7f6bd8e14034b3cb70b3fadb7db246a77
blob - 06509b3c452eaacfb6f796d10e2064b60fdfd3c0
blob + 2cced308bd760646e36ca461e25e4c2323e5565b
--- tog/tog.c
+++ tog/tog.c
@@ -4476,8 +4476,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;