Skip to content

Commit

Permalink
fix: correct npe if null is returned from attribute value (#2889)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Sep 20, 2022
1 parent eb105fb commit fc1e21e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,7 +49,7 @@ public String getAttributeValue(int index) {
// 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) {
Expand Down

0 comments on commit fc1e21e

Please sign in to comment.