diff options
Diffstat (limited to 'runtime/mirror/string.cc')
| -rw-r--r-- | runtime/mirror/string.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc index 45610dccc8..be869d4e6a 100644 --- a/runtime/mirror/string.cc +++ b/runtime/mirror/string.cc @@ -254,7 +254,11 @@ CharArray* String::ToCharArray(Thread* self) { StackHandleScope<1> hs(self); Handle<String> string(hs.NewHandle(this)); CharArray* result = CharArray::Alloc(self, GetLength()); - memcpy(result->GetData(), string->GetValue(), string->GetLength() * sizeof(uint16_t)); + if (result != nullptr) { + memcpy(result->GetData(), string->GetValue(), string->GetLength() * sizeof(uint16_t)); + } else { + self->AssertPendingOOMException(); + } return result; } |