diff --git a/extended-toc.php b/extended-toc.php index eeada82..57501c7 100644 --- a/extended-toc.php +++ b/extended-toc.php @@ -433,6 +433,10 @@ if( !class_exists('ExToC') ) { private function exctract_headings($pagenum) { /** find all header tags within the page **/ preg_match_all('/(]*>).*<\/h\2>/msuU', $this->pages[$pagenum-1], $matches, PREG_SET_ORDER); + + if (count($matches) == 0) { + return null; + } /** Check the headings that are desired */ if( count($this->options['heading_levels']) != 6 ) {