Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE #1020

Merged
merged 2 commits into from Feb 20, 2020
Merged

Fix NPE #1020

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -202,6 +202,10 @@ public void nextIsType() {

@Test
public void firstIsALoad0() {
// should set cursor to null when no opcodes are present
matcher.firstIsALoad0(m);
assertNull(matcher.cursor);

// should set cursor to null when opcode mismatch
m.visitInsn(Opcodes.NOP);
matcher.firstIsALoad0(m);
Expand Down
Expand Up @@ -35,7 +35,7 @@ abstract class AbstractMatcher {
final void firstIsALoad0(final MethodNode methodNode) {
cursor = methodNode.instructions.getFirst();
skipNonOpcodes();
if (cursor.getOpcode() == Opcodes.ALOAD
if (cursor != null && cursor.getOpcode() == Opcodes.ALOAD
&& ((VarInsnNode) cursor).var == 0) {
return;
}
Expand Down