Commit ba01b99

Neale Pickett  ·  2025-12-30 14:59:34 -0500 EST
parent ed551e4
Fix nil pointer deref on unsigned commits
1 files changed,  +9, -7
+9, -7
......@@ -795,6 +795,9 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
795795 Entry: entry,
796796 URL: tw.Config.getFileURL(tw.PageData.RevData, fname),
797797 Crumbs: crumbs,
798+ Author: &git.Signature{
799+ Name: "unknown",
800+ },
798801 }
799802
800803 // `git rev-list` is pretty expensive here, so we have a flag to disable
......@@ -808,15 +811,14 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
808811 })
809812 bail(err)
810813
811- var lc *git.Commit
812814 if len(lastCommits) > 0 {
813- lc = lastCommits[0]
815+ lc := lastCommits[0]
816+ item.CommitURL = tw.Config.getCommitURL(lc.ID.String())
817+ item.CommitID = getShortID(lc.ID.String())
818+ item.Summary = lc.Summary()
819+ item.When = lc.Author.When.Format(time.DateOnly)
820+ item.Author = lc.Author
814821 }
815- item.CommitURL = tw.Config.getCommitURL(lc.ID.String())
816- item.CommitID = getShortID(lc.ID.String())
817- item.Summary = lc.Summary()
818- item.When = lc.Author.When.Format(time.DateOnly)
819- item.Author = lc.Author
820822 }
821823
822824 fpath := tw.Config.getFileURL(tw.PageData.RevData, fmt.Sprintf("%s.html", fname))