From bbec4dc19fe40faddd65e311cc370c30c1a3eb46 Mon Sep 17 00:00:00 2001 From: CreepNT Date: Sun, 25 Aug 2024 13:20:10 +0200 Subject: [PATCH] NIDAnalyzer: check that import thunk exists before renaming Make sure the import thunk exists before attempting to rename it; otherwise, the analyzer will fail. ?Workaround for another bug? --- src/main/java/vitaloaderredux/analyzer/NIDAnalyzer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/vitaloaderredux/analyzer/NIDAnalyzer.java b/src/main/java/vitaloaderredux/analyzer/NIDAnalyzer.java index f0c4f3f..b37b00e 100644 --- a/src/main/java/vitaloaderredux/analyzer/NIDAnalyzer.java +++ b/src/main/java/vitaloaderredux/analyzer/NIDAnalyzer.java @@ -165,7 +165,13 @@ private void analyzeFunction(IEType importOrExport, String libraryName, Address func.setName(databaseName, SourceType.ANALYSIS); if (importOrExport == IEType.IMPORT) { //Set name for the thunk too - func.getThunkedFunction(true).setName(databaseName, SourceType.ANALYSIS); + Function thunk = func.getThunkedFunction(true); + if (thunk == null) { + helper.logf("Import thunk for %s_%08X (%s) not found (bug?)", + libraryName, functionNID, databaseName); + } else { + thunk.setName(databaseName, SourceType.ANALYSIS); + } } helper.symTbl.createLabel(funcAddr, oldName, SourceType.ANALYSIS);