Goit

Simple and lightweight Git web server
git clone http://git.omkov.net/Goit
Log | Tree | Refs | README | Download

AuthorJakob Wakeling <[email protected]>
Date2023-12-17 00:42:14
Commit6b13ddb62458c060b3fe9db08e470f30d1a7b550
Parentfc3cc2ff51e7d7a6131587eb40f96215adb3a428

Prevent segfault during diffstat calculation

Diffstat

M src/goit/git.go | 4 +++-

1 files changed, 3 insertions, 1 deletions

diff --git a/src/goit/git.go b/src/goit/git.go
index 75b779f..6db44a9 100644
--- a/src/goit/git.go
+++ b/src/goit/git.go
@@ -263,7 +263,9 @@ func DiffStats(c *object.Commit) ([]DiffStat, error) {
 		}
 
 		from, to := fp.Files()
-		if from == nil /* Added */ {
+		if from == nil && to == nil {
+			continue
+		} else if from == nil /* Added */ {
 			stat.Name = to.Path()
 			stat.Status = "A"
 		} else if to == nil /* Deleted */ {