From 2f6d4c72f931dc1840b9d0924e279a14b0701287 Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Wed, 7 Mar 2012 21:19:16 -0800 Subject: [PATCH] Fix an issue where a non-styled string could be made into a styled string If a styled version of an otherwise identical string is encountered before a non-styled version, aapt merges the two, effectively making the non-styled string have a spurious style. Change-Id: I424a61c0c83c59e0b9c8939e457402efd06a7a4f --- StringPool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/StringPool.cpp b/StringPool.cpp index fe88e37..7f137ce 100644 --- a/StringPool.cpp +++ b/StringPool.cpp @@ -174,7 +174,9 @@ ssize_t StringPool::add(const String16& ident, const String16& value, } const bool first = vidx < 0; - if (first || !mergeDuplicates) { + const bool styled = (pos >= 0 && (size_t)pos < mEntryStyleArray.size()) ? + mEntryStyleArray[pos].spans.size() : 0; + if (first || styled || !mergeDuplicates) { pos = mEntryArray.add(eidx); if (first) { vidx = mValues.add(value, pos); -- 2.45.2