mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
More robust getPage() error handling.
This commit is contained in:
parent
0c95bc7d83
commit
d0e93721ae
4 changed files with 33 additions and 3 deletions
|
@ -56,6 +56,7 @@ class PDFPageView {
|
|||
this.id = options.id;
|
||||
this.renderingId = 'page' + this.id;
|
||||
|
||||
this.pdfPage = null;
|
||||
this.pageLabel = null;
|
||||
this.rotation = 0;
|
||||
this.scale = options.scale || DEFAULT_SCALE;
|
||||
|
@ -110,6 +111,7 @@ class PDFPageView {
|
|||
this.reset();
|
||||
if (this.pdfPage) {
|
||||
this.pdfPage.cleanup();
|
||||
this.pdfPage = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,6 +343,11 @@ class PDFPageView {
|
|||
this.reset(); // Ensure that we reset all state to prevent issues.
|
||||
}
|
||||
|
||||
if (!this.pdfPage) {
|
||||
this.renderingState = RenderingStates.FINISHED;
|
||||
return Promise.reject(new Error('Page is not loaded'));
|
||||
}
|
||||
|
||||
this.renderingState = RenderingStates.RUNNING;
|
||||
|
||||
let pdfPage = this.pdfPage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue