File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -707,10 +707,18 @@ class Page {
707707 // Ensure that the structTree will contain the page's annotations.
708708 await this . _parsedAnnotations ;
709709
710- const structTree = await this . pdfManager . ensure ( this , "_parseStructTree" , [
711- structTreeRoot ,
712- ] ) ;
713- return this . pdfManager . ensure ( structTree , "serializable" ) ;
710+ try {
711+ const structTree = await this . pdfManager . ensure (
712+ this ,
713+ "_parseStructTree" ,
714+ [ structTreeRoot ]
715+ ) ;
716+ const data = await this . pdfManager . ensure ( structTree , "serializable" ) ;
717+ return data ;
718+ } catch ( ex ) {
719+ warn ( `getStructTree: "${ ex } ".` ) ;
720+ return null ;
721+ }
714722 }
715723
716724 /**
Original file line number Diff line number Diff line change @@ -757,7 +757,10 @@ class StructTreePage {
757757
758758 const parent = dict . get ( "P" ) ;
759759
760- if ( ! parent || isName ( parent . get ( "Type" ) , "StructTreeRoot" ) ) {
760+ if (
761+ ! ( parent instanceof Dict ) ||
762+ isName ( parent . get ( "Type" ) , "StructTreeRoot" )
763+ ) {
761764 if ( ! this . addTopLevelNode ( dict , element ) ) {
762765 map . delete ( dict ) ;
763766 }
You can’t perform that action at this time.
0 commit comments