fix: correct npe if null is returned from attribute value (#2889)

This commit is contained in:
Connor Tumbleson 2022-09-20 07:19:28 -04:00 committed by GitHub
parent eb105fb26d
commit fc1e21e9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,9 @@ public class AndroidManifestResourceParser extends AXmlResourceParser {
@Override
public String getAttributeValue(int index) {
String value = super.getAttributeValue(index);
if (value == null) {
return "";
}
if (!isNumericStringMetadataAttributeValue(index, value)) {
return value;
@ -46,7 +49,7 @@ public class AndroidManifestResourceParser extends AXmlResourceParser {
// Otherwise, when the decoded app is rebuilt, aapt will incorrectly encode
// the value as an int or float (depending on aapt version), breaking the original
// app functionality.
return "\\ " + super.getAttributeValue(index).trim();
return "\\ " + value.trim();
}
private boolean isNumericStringMetadataAttributeValue(int index, String value) {