Merge remote-tracking branch 'origin/GT-1-dragonmacher-npe-action-fix'

This commit is contained in:
ghidravore
2020-08-04 17:13:27 -04:00
@@ -112,8 +112,7 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
ClangNode parent = tokenAtCursor.Parent();
if (parent instanceof ClangStatement) {
PcodeOp op = ((ClangStatement) parent).getPcodeOp();
int opCode = op.getOpcode();
if (opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND) {
if (isCallOp(op)) {
return op;
}
}
@@ -141,8 +140,7 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
Iterator<PcodeOpAST> iter = hfunc.getPcodeOps(addr);
while (iter.hasNext()) {
PcodeOpAST op = iter.next();
int opCode = op.getOpcode();
if (opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND) {
if (isCallOp(op)) {
return op;
}
}
@@ -150,6 +148,16 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
return null;
}
private static boolean isCallOp(PcodeOp op) {
if (op == null) {
return false;
}
int opCode = op.getOpcode();
return opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND;
}
private Function getCalledFunction(Program program, PcodeOp op) {
if (op.getOpcode() != PcodeOp.CALL) {
return null;