Guard against empty/malformed markdown list entries

This commit is contained in:
Christian Muehlhaeuser
2019-12-24 02:45:35 +01:00
parent 7b96e021e6
commit 3a479d0c85
+5 -2
View File
@@ -125,11 +125,14 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element {
}
post := "\n"
if node.LastChild().Kind() == ast.KindList || node.NextSibling() == nil {
if (node.LastChild() != nil && node.LastChild().Kind() == ast.KindList) ||
node.NextSibling() == nil {
post = ""
}
if node.FirstChild().FirstChild().Kind() == astext.KindTaskCheckBox {
if node.FirstChild() != nil &&
node.FirstChild().FirstChild() != nil &&
node.FirstChild().FirstChild().Kind() == astext.KindTaskCheckBox {
nc := node.FirstChild().FirstChild().(*astext.TaskCheckBox)
return Element{