Skip to content

Commit da605b5

Browse files
committed
better fix if no bookmarks
1 parent 02a65cf commit da605b5

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/MyPdf.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,13 +1402,15 @@ public function createIndex(
14021402
$this->Ln(10);
14031403

14041404
// get the number of bookmarks
1405-
$size=sizeof($this->outlines);
1405+
$size = sizeof($this->outlines);
14061406

1407-
// get the size of the "P. xx" cell
1408-
if ($size > 0) {
1409-
$pageCellSize=$this->GetStringWidth('p. '.$this->outlines[$size-1]['p'])+2;
1407+
if ($size === 0) {
1408+
return;
14101409
}
1411-
1410+
1411+
// get the size of the "P. xx" cell
1412+
$pageCellSize=$this->GetStringWidth('p. '.$this->outlines[$size-1]['p'])+2;
1413+
14121414
// Foreach bookmark
14131415
for ($i=0; $i<$size; $i++) {
14141416
// if we need a new page => add a new page

0 commit comments

Comments
 (0)