File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -639,16 +639,19 @@ Buffer.concat = function concat(list, length) {
639639 }
640640
641641 validateOffset ( length , 'length' ) ;
642- const buffer = allocate ( length ) ;
643- let pos = 0 ;
644642 for ( let i = 0 ; i < list . length ; i ++ ) {
645- const buf = list [ i ] ;
646- if ( ! isUint8Array ( buf ) ) {
643+ if ( ! isUint8Array ( list [ i ] ) ) {
647644 // TODO(BridgeAR): This should not be of type ERR_INVALID_ARG_TYPE.
648645 // Instead, find the proper error code for this.
649646 throw new ERR_INVALID_ARG_TYPE (
650- `list[${ i } ]` , [ 'Buffer' , 'Uint8Array' ] , buf ) ;
647+ `list[${ i } ]` , [ 'Buffer' , 'Uint8Array' ] , list [ i ] ) ;
651648 }
649+ }
650+
651+ const buffer = allocate ( length ) ;
652+ let pos = 0 ;
653+ for ( let i = 0 ; i < list . length ; i ++ ) {
654+ const buf = list [ i ] ;
652655 if ( pos + buf . length > length ) {
653656 TypedArrayPrototypeSet ( buffer ,
654657 TypedArrayPrototypeSlice ( buf , 0 , length - pos ) ,
You can’t perform that action at this time.
0 commit comments