diff --git a/file.go b/file.go index 491b410..8a966cc 100644 --- a/file.go +++ b/file.go @@ -699,6 +699,9 @@ func (fp *FilePages) PageHistory(p string) ([]Revision, error) { commitId := line[0:start] rest := line[start+1:] pageText := gitRevision(fp.dirname, page, commitId) + if pageText == "" { + return nil, errors.New("git revision failed") + } revisions = append(revisions, Revision{ Version: commitId, Page: DiffPage{Content: pageText}, @@ -727,8 +730,14 @@ func gitRevision(dirname, page, version string) string { cmd.Dir = dirname buf := bytes.Buffer{} cmd.Stdout = &buf - cmd.Start() - cmd.Wait() + err := cmd.Start() + if err != nil { + return "" + } + err = cmd.Wait() + if err != nil { + return "" + } return buf.String() }