From 4cec3971823ce518ee9d4ec01b8e36e9dd93a40a Mon Sep 17 00:00:00 2001 From: Zion Leonahenahe Basque Date: Wed, 8 May 2024 18:02:14 -1000 Subject: [PATCH] Fix rename catch on external funcs (#97) --- decomp2dbg/__init__.py | 2 +- .../src/main/java/decomp2dbg/D2DGhidraServerAPI.java | 3 +++ decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DPlugin.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/decomp2dbg/__init__.py b/decomp2dbg/__init__.py index 8ec10a0..3f5877a 100644 --- a/decomp2dbg/__init__.py +++ b/decomp2dbg/__init__.py @@ -1,4 +1,4 @@ -__version__ = "3.9.0" +__version__ = "3.9.1" try: from .clients.client import DecompilerClient diff --git a/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DGhidraServerAPI.java b/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DGhidraServerAPI.java index a497f47..71658fa 100644 --- a/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DGhidraServerAPI.java +++ b/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DGhidraServerAPI.java @@ -121,6 +121,9 @@ public Map function_headers() { var fm = program.getFunctionManager(); var functions = fm.getFunctions(true); for (Function func : functions) { + if(func == null) + continue; + Map funcInfo = new HashMap<>(); funcInfo.put("name", func.getName()); funcInfo.put("size", (int) func.getBody().getNumAddresses()); diff --git a/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DPlugin.java b/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DPlugin.java index 9386f50..61ac092 100644 --- a/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DPlugin.java +++ b/decompilers/d2d_ghidra/src/main/java/decomp2dbg/D2DPlugin.java @@ -362,6 +362,9 @@ else if(obj instanceof FunctionSymbol) { var addr = sym.getAddress().getOffset(); var func = this.getCurrentProgram().getFunctionManager().getFunction(addr); + if(func == null) + continue; + Map funcInfo = new HashMap<>(); funcInfo.put("name", newName); funcInfo.put("size", (int) func.getBody().getNumAddresses());