summaryrefslogtreecommitdiff
path: root/deps/v8/src/strings/uri.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/strings/uri.cc')
-rw-r--r--deps/v8/src/strings/uri.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/deps/v8/src/strings/uri.cc b/deps/v8/src/strings/uri.cc
index 430c8dd0eb..de4e339b39 100644
--- a/deps/v8/src/strings/uri.cc
+++ b/deps/v8/src/strings/uri.cc
@@ -195,10 +195,14 @@ MaybeHandle<String> Uri::Decode(Isolate* isolate, Handle<String> uri,
String);
DisallowHeapAllocation no_gc;
- CopyChars(result->GetChars(no_gc), one_byte_buffer.data(),
- one_byte_buffer.size());
- CopyChars(result->GetChars(no_gc) + one_byte_buffer.size(),
- two_byte_buffer.data(), two_byte_buffer.size());
+ uc16* chars = result->GetChars(no_gc);
+ if (!one_byte_buffer.empty()) {
+ CopyChars(chars, one_byte_buffer.data(), one_byte_buffer.size());
+ chars += one_byte_buffer.size();
+ }
+ if (!two_byte_buffer.empty()) {
+ CopyChars(chars, two_byte_buffer.data(), two_byte_buffer.size());
+ }
return result;
}