From 5c3148251a73c0c85a7e3f07de32603e4cffcf94 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Thu, 3 Oct 2013 17:33:34 +0900 Subject: [PATCH] Fix: Native crash when an empty attribute is written. DO NOT MERGE Bug: 10964805 Change-Id: I862a6b920a7a09eac4e012bfe75f087b2d7b4fe6 --- .../policyimpl/dictionary/header/header_read_write_utils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp index 2694ce8d5..5ded8f6a1 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp @@ -139,6 +139,9 @@ const char *const HeaderReadWriteUtils::REQUIRES_FRENCH_LIGATURE_PROCESSING_KEY int *const writingPos) { for (AttributeMap::const_iterator it = headerAttributes->begin(); it != headerAttributes->end(); ++it) { + if (it->first.empty() || it->second.empty()) { + continue; + } // Write a key. if (!buffer->writeCodePointsAndAdvancePosition(&(it->first.at(0)), it->first.size(), true /* writesTerminator */, writingPos)) {