Don't return null for null utf in AllocFromModifiedUtf8.
If you pass in a null utf string it should not be the same behavior
as out of memory.
This previously caused serious problems in:
https://android-review.googlesource.com/#/c/80768/
Change-Id: I9dfb710b57f6cc91064812f52a3db64254769461
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index 3f35210..d4f11b2 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -138,9 +138,7 @@
}
String* String::AllocFromModifiedUtf8(Thread* self, const char* utf) {
- if (UNLIKELY(utf == nullptr)) {
- return nullptr;
- }
+ DCHECK(utf != nullptr);
size_t char_count = CountModifiedUtf8Chars(utf);
return AllocFromModifiedUtf8(self, char_count, utf);
}