summaryrefslogtreecommitdiff
path: root/src/node_buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r--src/node_buffer.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index a06186758..bd0227921 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -303,11 +303,11 @@ void Base64Slice(const FunctionCallbackInfo<Value>& args) {
void Copy(const FunctionCallbackInfo<Value> &args) {
Environment* env = Environment::GetCurrent(args);
- Local<Object> target = args[0]->ToObject(env->isolate());
-
- if (!HasInstance(target))
+ if (!HasInstance(args[0]))
return env->ThrowTypeError("first arg should be a Buffer");
+ Local<Object> target = args[0]->ToObject(env->isolate());
+
ARGS_THIS(args.This())
size_t target_length = target->GetIndexedPropertiesExternalArrayDataLength();
char* target_data = static_cast<char*>(