Skip to content

Commit 0848790

Browse files
committed
avoid unwrap()
1 parent d329b95 commit 0848790

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/popups/branchlist.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,12 @@ impl BranchListPopup {
706706
.take(height)
707707
.enumerate()
708708
{
709-
let date_local = Local
709+
let date_text = Local
710710
.timestamp_opt(displaybranch.top_commit_time, 0)
711-
.unwrap();
712-
let date_text = date_local.date_naive().to_string() + " ";
711+
.earliest()
712+
.map_or("????-??-?? ".to_string(), |date| {
713+
date.date_naive().to_string() + " "
714+
});
713715
let author_text =
714716
displaybranch.top_commit_author.clone() + " ";
715717

0 commit comments

Comments
 (0)