Ghidra is a software reverse engineering (SRE) framework
GT-1 - small bug fix for NPE
dragonmacher61e7417a58b4
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/OverridePrototypeAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/OverridePrototypeAction.javaindex 00d7bc1fb7..2e0cd15444 100644--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/OverridePrototypeAction.java+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/OverridePrototypeAction.java@@ -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;