diff --git a/html/parse.go b/html/parse.go index 2bd572ee..994c8c50 100644 --- a/html/parse.go +++ b/html/parse.go @@ -1692,8 +1692,9 @@ func inCellIM(p *parser) bool { return true } // Close the cell and reprocess. - p.popUntil(tableScope, a.Td, a.Th) - p.clearActiveFormattingElements() + if p.popUntil(tableScope, a.Td, a.Th) { + p.clearActiveFormattingElements() + } p.im = inRowIM return false } @@ -2329,4 +2330,4 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { c = next } return result, nil -} \ No newline at end of file +} diff --git a/html/testdata/go/issue_30600_parse_panics_in_cell_mode.dat b/html/testdata/go/issue_30600_parse_panics_in_cell_mode.dat new file mode 100644 index 00000000..741f4b1a --- /dev/null +++ b/html/testdata/go/issue_30600_parse_panics_in_cell_mode.dat @@ -0,0 +1,12 @@ +#data +