patches for style decoding
@@ -138,8 +138,8 @@ public class StringBlock {
}
StringBuilder html = new StringBuilder(raw.length() + 32);
int[] opened = new int[style.length / 3];
+ boolean[] unclosed = new boolean[style.length / 3];
int offset = 0, depth = 0;
- boolean closeTagOnEnd = false;
while (true) {
int i = -1, j;
for (j = 0; j != style.length; j += 3) {
@@ -156,7 +156,7 @@ public class StringBlock {
int end = style[last + 2];
if (end >= start) {
if (style[last + 1] == -1 && end != -1) {
- closeTagOnEnd = true;
+ unclosed[j] = true;
}
break;
}
@@ -169,8 +169,8 @@ public class StringBlock {
depth = j + 1;
if (offset < start) {
html.append(ResXmlEncoders.escapeXmlChars(raw.substring(offset, start)));
- if (closeTagOnEnd) {
- if (j > 0) {
+ if (j >= 0 && unclosed.length >= j && unclosed[j]) {
+ if (unclosed.length > (j + 1) && unclosed[j + 1] || unclosed.length == 1) {
outputStyleTag(getString(style[opened[j]]), html, true);
}
}
