fix(ghidra): avoid crash if we try to decompile a faulty addr/func

This may happen if either something goes wrong during the command or if
the passed addr/func for custom decompilation is simply faulty.
pull/901/head
anthraxx 5 years ago committed by Disconnect3d
parent e8b51243c8
commit 6354fdce7a

@ -31,6 +31,10 @@ def decompile(func=None):
except: except:
func = "main" func = "main"
src = r2.cmdj("pdgj @" + func) src = r2.cmdj("pdgj @" + func)
# Early exit if decompile command failed horribly, like unknown addr/func
if not src:
return []
source = src.get("code", "") source = src.get("code", "")
curline = None curline = None
try: try:

Loading…
Cancel
Save