From 8b33a1d8e411e235d7834a1268ce74e42e5eec65 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 22 Mar 2011 13:10:50 -0700 Subject: [PATCH] Guard failed buffer constructions. Thanks to Jeremy Barnes for pointing it out. --- src/node_buffer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index dfa5ea38dcd..b46abe1e3d4 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -134,6 +134,7 @@ Buffer* Buffer::New(size_t length) { Local arg = Integer::NewFromUnsigned(length); Local b = constructor_template->GetFunction()->NewInstance(1, &arg); + if (b.IsEmpty()) return NULL; return ObjectWrap::Unwrap(b); }