diff --git a/modules/doc/library/Doc/DocParser.php b/modules/doc/library/Doc/DocParser.php index 08ad5cf56..9077d3ef9 100644 --- a/modules/doc/library/Doc/DocParser.php +++ b/modules/doc/library/Doc/DocParser.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Doc; +use LogicException; use SplStack; use Icinga\Data\Tree\SimpleTree; use Icinga\Exception\NotReadableError; @@ -169,6 +170,9 @@ class DocParser } $stack->push($section); } else { + if ($stack->isEmpty()) { + throw new LogicException('Heading required'); + } $stack->top()->appendContent($line); } // Save last line for setext-style headers