mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibMarkdown: Prevent a crash when rendering code blocks to console
When parsing a code block not in a section (in a file without a heading), the parser would initialize the code block with an uninitialized (invalid) value for current_section. Accessing this value would later cause a segmentation fault in render_to_terminal.
This commit is contained in:
parent
80563120e2
commit
e2566d5126
1 changed files with 1 additions and 1 deletions
|
@ -91,7 +91,7 @@ OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
|
||||||
NonnullOwnPtrVector<Block> blocks;
|
NonnullOwnPtrVector<Block> blocks;
|
||||||
|
|
||||||
StringBuilder paragraph_text;
|
StringBuilder paragraph_text;
|
||||||
Heading* current_section;
|
Heading* current_section = nullptr;
|
||||||
|
|
||||||
auto flush_paragraph = [&] {
|
auto flush_paragraph = [&] {
|
||||||
if (paragraph_text.is_empty())
|
if (paragraph_text.is_empty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue