mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-28 20:18:16 -04:00
Prevent irregular markdown from acccessing nil TableWriter
This commit is contained in:
1 file changed
+8
@@ -85,12 +85,20 @@ func (e *TableElement) Finish(w io.Writer, ctx RenderContext) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *TableRowElement) 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.writer.Append(ctx.table.cell)
|
||||||
ctx.table.cell = []string{}
|
ctx.table.cell = []string{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *TableHeadElement) Finish(w io.Writer, ctx RenderContext) error {
|
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.writer.SetHeader(ctx.table.header)
|
||||||
ctx.table.header = []string{}
|
ctx.table.header = []string{}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user