core: fix NPE in signature parser (#313)

This commit is contained in:
Skylot
2018-07-16 18:16:13 +03:00
parent 03a09debfa
commit c5994f954a
2 changed files with 12 additions and 6 deletions
@@ -192,23 +192,23 @@ public class ClassNode extends LineAttrNode implements ILoadable, IDexNode {
break;
}
}
} catch (JadxRuntimeException e) {
} catch (Exception e) {
LOG.error("Class signature parse error: {}", this, e);
}
}
private void setFieldsTypesFromSignature() {
for (FieldNode field : fields) {
SignatureParser sp = SignatureParser.fromNode(field);
if (sp != null) {
try {
try {
SignatureParser sp = SignatureParser.fromNode(field);
if (sp != null) {
ArgType gType = sp.consumeType();
if (gType != null) {
field.setType(gType);
}
} catch (JadxRuntimeException e) {
LOG.error("Field signature parse error: {}", field, e);
}
} catch (Exception e) {
LOG.error("Field signature parse error: {}.{}", this.getFullName(), field.getName(), e);
}
}
}
@@ -180,6 +180,9 @@ public class SignatureParser {
next();
// type parsing not completed, proceed to inner class
ArgType inner = consumeObjectType(true);
if (inner == null) {
throw new JadxRuntimeException("No inner type found: " + debugString());
}
return ArgType.genericInner(genericType, inner.getObject(), inner.getGenericTypes());
} else {
consume(';');
@@ -289,6 +292,9 @@ public class SignatureParser {
}
private String debugString() {
if (pos >= sign.length()) {
return sign;
}
return sign + " at position " + pos + " ('" + sign.charAt(pos) + "')";
}