aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2013-10-03 01:44:39 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-03 01:44:39 -0700
commit372ce55954e8262ad29ed73e151f26bee3a07c3b (patch)
tree5eeb4696baccbffb6e3dce54cad199cf9d93e95a
parent5fbd356a735ae02a671ca7db6dd57050e9fb0b17 (diff)
parent7e6e97014d7d031f233267220a627b3dfdfd26dc (diff)
downloadlatinime-372ce55954e8262ad29ed73e151f26bee3a07c3b.tar.gz
latinime-372ce55954e8262ad29ed73e151f26bee3a07c3b.tar.xz
latinime-372ce55954e8262ad29ed73e151f26bee3a07c3b.zip
am 7e6e9701: Merge "Fix: Native crash when an empty attribute is written."
* commit '7e6e97014d7d031f233267220a627b3dfdfd26dc': Fix: Native crash when an empty attribute is written.
-rw-r--r--native/jni/src/suggest/policyimpl/dictionary/header/header_read_write_utils.cpp3
1 files changed, 3 insertions, 0 deletions
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)) {