makeFastBuffer should not segfault but rather throw on non-buffer

This commit is contained in:
Ryan Dahl committed 2011-05-19 12:13:48 -07:00
1 parent f4e69e44ff
commit 5e409c2f1a
2 files changed
+9

No files matched your search

+5
View File
@@ -679,6 +679,11 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) {
HandleScope scope;
if (!Buffer::HasInstance(args[0])) {
return ThrowException(Exception::TypeError(String::New(
"First argument must be a Buffer")));
}
Buffer *buffer = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
Local<Object> fast_buffer = args[1]->ToObject();;
uint32_t offset = args[2]->Uint32Value();