Guard failed buffer constructions.

Thanks to Jeremy Barnes for pointing it out.
v0.7.4-release
Ryan Dahl 2011-03-22 13:10:50 -07:00
parent 391f087981
commit 8b33a1d8e4
1 changed files with 1 additions and 0 deletions

View File

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