aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2020-01-22 10:02:57 +0200
committerzeripath <art27@cantab.net>2020-01-22 08:02:57 +0000
commitf82a8054787e3a334619b918b4e416b3d0bea47a (patch)
tree4b41a88b36762756111079c42c9d4fc96e78069c
parent0dced15c1a7f984f5a363c10853f9348c9b39aa9 (diff)
downloadgitea-f82a8054787e3a334619b918b4e416b3d0bea47a.tar.gz
gitea-f82a8054787e3a334619b918b4e416b3d0bea47a.zip
Check if diff actually contains sections when rendering (#9926) (#9933)
-rw-r--r--services/gitdiff/gitdiff.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index b8efa8a43f..fc55c03595 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -344,7 +344,7 @@ func (diffFile *DiffFile) GetHighlightClass() string {
// GetTailSection creates a fake DiffLineSection if the last section is not the end of the file
func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, rightCommitID string) *DiffSection {
- if diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
+ if len(diffFile.Sections) == 0 || diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
return nil
}
leftCommit, err := gitRepo.GetCommit(leftCommitID)