Commit c5994f95 authored by Skylot's avatar Skylot

core: fix NPE in signature parser (#313)

parent 03a09deb
......@@ -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) + "')";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment