[Regression] Prevent errors, during loading, in the viewer for XFA-documents (PR 14295 follow-up)
In the second commit in PR 14295, I forgot that the pages in XFA-documents don't have references (like in regular PDF documents); sorry about that!
This commit is contained in:
parent
2e2d049a9c
commit
8fa5fcfe72
@ -120,7 +120,7 @@ class PDFLinkService {
|
|||||||
if (typeof destRef === "object" && destRef !== null) {
|
if (typeof destRef === "object" && destRef !== null) {
|
||||||
pageNumber = this._cachedPageNumber(destRef);
|
pageNumber = this._cachedPageNumber(destRef);
|
||||||
|
|
||||||
if (pageNumber === null) {
|
if (!pageNumber) {
|
||||||
// Fetch the page reference if it's not yet available. This could
|
// Fetch the page reference if it's not yet available. This could
|
||||||
// only occur during loading, before all pages have been resolved.
|
// only occur during loading, before all pages have been resolved.
|
||||||
this.pdfDocument
|
this.pdfDocument
|
||||||
@ -446,6 +446,9 @@ class PDFLinkService {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_cachedPageNumber(pageRef) {
|
_cachedPageNumber(pageRef) {
|
||||||
|
if (!pageRef) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
const refStr =
|
const refStr =
|
||||||
pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
|
pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
|
||||||
return this._pagesRefCache?.[refStr] || null;
|
return this._pagesRefCache?.[refStr] || null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user