Add 'null' check to parseContentDepth

Does not fix the actual problem, but at least prevents resource
allocation until OOM.
This commit is contained in:
Florian Schmaus 2014-05-11 10:18:49 +02:00
parent e0b8577930
commit 98333e362d
1 changed files with 5 additions and 1 deletions

View File

@ -156,7 +156,11 @@ public class PacketParserUtils {
public static String parseContentDepth(XmlPullParser parser, int depth) throws XmlPullParserException, IOException {
StringBuilder content = new StringBuilder();
while (!(parser.next() == XmlPullParser.END_TAG && parser.getDepth() == depth)) {
content.append(parser.getText());
String text = parser.getText();
if (text == null) {
throw new IllegalStateException("Parser should never return 'null' on getText() here");
}
content.append(text);
}
return content.toString();
}