Skip to content

Commit

Permalink
buffer: simplify check size in assertSize
Browse files Browse the repository at this point in the history
PR-URL: #18665
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Connormiha authored and MylesBorins committed Feb 21, 2018
1 parent 876e186 commit c38576e
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 @@ -237,9 +237,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 c38576e

Please sign in to comment.