mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Prevent irregular markdown from acccessing nil TableWriter
This commit is contained in:
@@ -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