Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created August 26, 2013 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/6343070 to your computer and use it in GitHub Desktop.
Save isaacs/6343070 to your computer and use it in GitHub Desktop.
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
index 99a6a9b..2e4db05 100644
--- a/src/string_bytes.cc
+++ b/src/string_bytes.cc
@@ -360,6 +360,9 @@ size_t StringBytes::StorageSize(Handle<Value> val, enum encoding encoding) {
return Buffer::Length(val);
}
+ if (!is_buffer && !val->IsString())
+ assert(0 && "non-string/buffer passed to StringBytes::StorageSize");
+
Local<String> str = val->ToString();
switch (encoding) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment