Fix pseudolocalizer at end of string
The accent pseudolocalizer would incorrectly process
the byte after the end of the string, which would end
up inserting null characters into the resulting
output.
Change-Id: I5cdabd6b0272d94073f06e180b8cbe7abafa3888
diff --git a/tools/aapt2/compile/Pseudolocalizer.cpp b/tools/aapt2/compile/Pseudolocalizer.cpp
index eae52d7..767d746 100644
--- a/tools/aapt2/compile/Pseudolocalizer.cpp
+++ b/tools/aapt2/compile/Pseudolocalizer.cpp
@@ -280,13 +280,13 @@
std::u16string chunk;
bool end = false;
chunk.append(&c, 1);
- while (!end && i < I) {
+ while (!end && i + 1 < I) {
++i;
c = s[i];
chunk.append(&c, 1);
if (isPossibleNormalPlaceholderEnd(c)) {
end = true;
- } else if (c == 't') {
+ } else if (i + 1 < I && c == 't') {
++i;
c = s[i];
chunk.append(&c, 1);