Skip to content

Commit

Permalink
buffer: simplify check size in assertSize
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18665
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Connormiha authored and MayaLekova committed May 8, 2018
1 parent 68c3027 commit 377e173
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ function assertSize(size) {

if (typeof size !== 'number') {
err = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'size', 'number', size);
} else if (size < 0) {
err = new errors.RangeError('ERR_INVALID_OPT_VALUE', 'size', size);
} else if (size > kMaxLength) {
} else if (size < 0 || size > kMaxLength) {
err = new errors.RangeError('ERR_INVALID_OPT_VALUE', 'size', size);
}

Expand Down

0 comments on commit 377e173

Please sign in to comment.