diff --git a/CHANGELOG.md b/CHANGELOG.md index d7cb6751..d5eb2b44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed - do not allow to ignore .gitignore files ([#825](https://github.com/extrawurst/gitui/issues/825)) +- crash in shallow repo ([#836](https://github.com/extrawurst/gitui/issues/836)) ## [0.16.2] - 2021-07-10 diff --git a/asyncgit/src/sync/commit_files.rs b/asyncgit/src/sync/commit_files.rs index 70c3afe3..ca9a1224 100644 --- a/asyncgit/src/sync/commit_files.rs +++ b/asyncgit/src/sync/commit_files.rs @@ -49,7 +49,9 @@ pub(crate) fn get_commit_diff( let commit = repo.find_commit(id.into())?; let commit_tree = commit.tree()?; let parent = if commit.parent_count() > 0 { - Some(repo.find_commit(commit.parent_id(0)?)?.tree()?) + repo.find_commit(commit.parent_id(0)?) + .ok() + .and_then(|c| c.tree().ok()) } else { None };