Skip to content

Commit

Permalink
fix #14. added check for nil for non-existing file
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Jul 4, 2017
1 parent 3959e2c commit e989632
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ func GetHmtlBody(path string) (string, error) {
if IsURL(path) {
return httpGet(path)
}
if _, err := os.Stat(path); os.IsNotExist(err) {
return "", err
}
return ConvertMd2Html(path)
}

Expand Down Expand Up @@ -262,7 +265,10 @@ func main() {

for i := 1; i <= pathsCount; i++ {
toc := <-ch
toc.Print()
// #14, check if there's realy Toc?
if toc != nil {
toc.Print()
}
}

// read md from stdin
Expand Down

0 comments on commit e989632

Please sign in to comment.