get_commit_diff on commit with unknown parent (#836)

This commit is contained in:
Stephan Dilly 2021-08-11 13:13:44 +02:00
parent 29f71f50d4
commit 71e3d9a9b8
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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
};