Improve the pageNumber
validation in BaseViewer.isPageVisible
(PR 10217 follow-up)
This commit is contained in:
parent
85de01e34b
commit
8b5bc8d7f9
@ -1096,9 +1096,15 @@ class BaseViewer {
|
|||||||
if (!this.pdfDocument) {
|
if (!this.pdfDocument) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pageNumber < 1 || pageNumber > this.pagesCount) {
|
if (
|
||||||
|
!(
|
||||||
|
Number.isInteger(pageNumber) &&
|
||||||
|
pageNumber > 0 &&
|
||||||
|
pageNumber <= this.pagesCount
|
||||||
|
)
|
||||||
|
) {
|
||||||
console.error(
|
console.error(
|
||||||
`${this._name}.isPageVisible: "${pageNumber}" is out of bounds.`
|
`${this._name}.isPageVisible: "${pageNumber}" is not a valid page.`
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user