Fix: Native crash when an empty attribute is written. DO NOT MERGE

Bug: 10964805
Change-Id: I862a6b920a7a09eac4e012bfe75f087b2d7b4fe6
main
Keisuke Kuroyanagi 2013-10-03 17:33:34 +09:00 committed by The Android Automerger
parent e26b750805
commit 3cc0a1d2e0
1 changed files with 3 additions and 0 deletions

View File

@ -139,6 +139,9 @@ const char *const HeaderReadWriteUtils::REQUIRES_FRENCH_LIGATURE_PROCESSING_KEY
int *const writingPos) { int *const writingPos) {
for (AttributeMap::const_iterator it = headerAttributes->begin(); for (AttributeMap::const_iterator it = headerAttributes->begin();
it != headerAttributes->end(); ++it) { it != headerAttributes->end(); ++it) {
if (it->first.empty() || it->second.empty()) {
continue;
}
// Write a key. // Write a key.
if (!buffer->writeCodePointsAndAdvancePosition(&(it->first.at(0)), it->first.size(), if (!buffer->writeCodePointsAndAdvancePosition(&(it->first.at(0)), it->first.size(),
true /* writesTerminator */, writingPos)) { true /* writesTerminator */, writingPos)) {