Skip to content

Commit f5faf86

Browse files
committed
Assert that numberToString is called with a number (issue 19877)
*NOTE:* Given that this is an *internal* function, used only in the worker-thread, it's not clear to me that this is an entirely "necessary" change.
1 parent c1a398d commit f5faf86

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/core/core_utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,13 @@ function recoverJsURL(str) {
632632
}
633633

634634
function numberToString(value) {
635+
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
636+
assert(
637+
typeof value === "number",
638+
`numberToString - the value (${value}) should be a number.`
639+
);
640+
}
641+
635642
if (Number.isInteger(value)) {
636643
return value.toString();
637644
}

0 commit comments

Comments
 (0)