Prevent irregular markdown from acccessing nil TableWriter

This commit is contained in:
Christian Muehlhaeuser
2019-12-30 07:04:13 +01:00
parent bf9cf1e06f
commit 3bd1742b48
+8
View File
@@ -85,12 +85,20 @@ func (e *TableElement) Finish(w io.Writer, ctx RenderContext) error {
}
func (e *TableRowElement) Finish(w io.Writer, ctx RenderContext) error {
if ctx.table.writer == nil {
return nil
}
ctx.table.writer.Append(ctx.table.cell)
ctx.table.cell = []string{}
return nil
}
func (e *TableHeadElement) Finish(w io.Writer, ctx RenderContext) error {
if ctx.table.writer == nil {
return nil
}
ctx.table.writer.SetHeader(ctx.table.header)
ctx.table.header = []string{}
return nil