From 7fdc36425d641ee862b7ea3790ef4e697028ce93 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 9 May 2020 11:58:28 +0200 Subject: [PATCH] Checking if we have headers (#2). --- extended-toc.php | 4 ++++ 1 file changed, 4 insertions(+) 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 ) {