Skip to content

Commit fc1e21e

Browse files
authored
fix: correct npe if null is returned from attribute value (#2889)
1 parent eb105fb commit fc1e21e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AndroidManifestResourceParser.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public class AndroidManifestResourceParser extends AXmlResourceParser {
3737
@Override
3838
public String getAttributeValue(int index) {
3939
String value = super.getAttributeValue(index);
40+
if (value == null) {
41+
return "";
42+
}
4043

4144
if (!isNumericStringMetadataAttributeValue(index, value)) {
4245
return value;
@@ -46,7 +49,7 @@ public String getAttributeValue(int index) {
4649
// Otherwise, when the decoded app is rebuilt, aapt will incorrectly encode
4750
// the value as an int or float (depending on aapt version), breaking the original
4851
// app functionality.
49-
return "\\ " + super.getAttributeValue(index).trim();
52+
return "\\ " + value.trim();
5053
}
5154

5255
private boolean isNumericStringMetadataAttributeValue(int index, String value) {

0 commit comments

Comments
 (0)