diff --git a/src/node_buffer.cc b/src/node_buffer.cc index acec3c420ce1d2..3a9aeb99a89240 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo& args) { void DecodeUTF8(const FunctionCallbackInfo& 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( @@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo& args) { ArrayBufferViewContents buffer(args[0]); - CHECK(args[1]->IsBoolean()); bool ignore_bom = args[1]->IsTrue(); const char* data = buffer.data();