Skip to content

Commit

Permalink
buffer: make decodeUTF8 params loose
Browse files Browse the repository at this point in the history
PR-URL: #45610
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
anonrig authored and danielleadams committed Jan 3, 2023
1 parent e2da381 commit bfcf4f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node_buffer.cc
Expand Up @@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args); // list, flags

CHECK_GE(args.Length(), 1);

if (!(args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer() ||
args[0]->IsArrayBufferView())) {
return node::THROW_ERR_INVALID_ARG_TYPE(
Expand All @@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {

ArrayBufferViewContents<char> buffer(args[0]);

CHECK(args[1]->IsBoolean());
bool ignore_bom = args[1]->IsTrue();

const char* data = buffer.data();
Expand Down

0 comments on commit bfcf4f0

Please sign in to comment.