Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 333f7e440274b2334ace286e7be5e46064fa3959..4133283f1c4c6e7695cda898dc8c408eb0c82590 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -1538,8 +1538,10 @@ void SerializationData::WriteTag(SerializationTag tag) { data.Add(tag); } |
void SerializationData::WriteMemory(const void* p, int length) { |
- i::Vector<uint8_t> block = data.AddBlock(0, length); |
- memcpy(&block[0], p, length); |
+ if (length > 0) { |
+ i::Vector<uint8_t> block = data.AddBlock(0, length); |
+ memcpy(&block[0], p, length); |
+ } |
} |