mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-01 22:54:24 +02:00
Catch attr lookup on internal attributes
Internal attributes will fail the AttrDecoder. Catch the errors and simply return the undecoded value which will be correct. Fixes #913
This commit is contained in:
parent
48285bde03
commit
9cb3df85d8
@ -17,6 +17,7 @@
|
|||||||
package brut.androlib.res.decoder;
|
package brut.androlib.res.decoder;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
|
import brut.androlib.err.UndefinedResObject;
|
||||||
import brut.androlib.res.data.ResPackage;
|
import brut.androlib.res.data.ResPackage;
|
||||||
import brut.androlib.res.data.ResResSpec;
|
import brut.androlib.res.data.ResResSpec;
|
||||||
import brut.androlib.res.data.value.ResAttr;
|
import brut.androlib.res.data.value.ResAttr;
|
||||||
@ -32,10 +33,15 @@ public class ResAttrDecoder {
|
|||||||
type, value, rawValue);
|
type, value, rawValue);
|
||||||
|
|
||||||
String decoded = null;
|
String decoded = null;
|
||||||
if (attrResId != 0) {
|
if (attrResId > 0) {
|
||||||
|
try {
|
||||||
ResAttr attr = (ResAttr) getCurrentPackage().getResTable()
|
ResAttr attr = (ResAttr) getCurrentPackage().getResTable()
|
||||||
.getResSpec(attrResId).getDefaultResource().getValue();
|
.getResSpec(attrResId).getDefaultResource().getValue();
|
||||||
|
|
||||||
decoded = attr.convertToResXmlFormat(resValue);
|
decoded = attr.convertToResXmlFormat(resValue);
|
||||||
|
} catch (UndefinedResObject ex) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return decoded != null ? decoded : resValue.encodeAsResXmlAttr();
|
return decoded != null ? decoded : resValue.encodeAsResXmlAttr();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user