We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a8ed04f commit 2007eb5Copy full SHA for 2007eb5
lib/internal/encoding.js
@@ -491,10 +491,18 @@ function makeTextDecoderJS() {
491
decode(input = empty, options = kEmptyObject) {
492
validateDecoder(this);
493
if (isAnyArrayBuffer(input)) {
494
- input = lazyBuffer().from(input);
+ try {
495
+ input = lazyBuffer().from(input);
496
+ } catch {
497
+ input = empty;
498
+ }
499
} else if (isArrayBufferView(input)) {
- input = lazyBuffer().from(input.buffer, input.byteOffset,
- input.byteLength);
500
501
+ input = lazyBuffer().from(input.buffer, input.byteOffset,
502
+ input.byteLength);
503
504
505
506
} else {
507
throw new ERR_INVALID_ARG_TYPE('input',
508
['ArrayBuffer', 'ArrayBufferView'],
0 commit comments