Browse Source

Guard failed buffer constructions.

Thanks to Jeremy Barnes for pointing it out.
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
8b33a1d8e4
  1. 1
      src/node_buffer.cc

1
src/node_buffer.cc

@ -134,6 +134,7 @@ Buffer* Buffer::New(size_t length) {
Local<Value> arg = Integer::NewFromUnsigned(length); Local<Value> arg = Integer::NewFromUnsigned(length);
Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg); Local<Object> b = constructor_template->GetFunction()->NewInstance(1, &arg);
if (b.IsEmpty()) return NULL;
return ObjectWrap::Unwrap<Buffer>(b); return ObjectWrap::Unwrap<Buffer>(b);
} }

Loading…
Cancel
Save