diff --git a/Plugin/Commands.cpp b/Plugin/Commands.cpp index 8c30cf4..10708f7 100644 --- a/Plugin/Commands.cpp +++ b/Plugin/Commands.cpp @@ -28,12 +28,17 @@ void Commands::analyzeStructures(BinaryViewRef bv) return; } + SharedAnalysisInfo info; CustomTypes::defineAll(bv); - auto file = std::make_shared(bv); - auto info = ObjectiveNinja::AnalysisProvider::infoForFile(file); + try { + auto file = std::make_shared(bv); + info = ObjectiveNinja::AnalysisProvider::infoForFile(file); - InfoHandler::applyInfoToView(info, bv); + InfoHandler::applyInfoToView(info, bv); + } catch (...) { + BinaryNinja::LogError("[Objective Ninja]: Error during analysis. Please report this bug!"); + } GlobalState::setFlag(bv, Flag::DidRunWorkflow); } diff --git a/Plugin/Workflow/Workflow.cpp b/Plugin/Workflow/Workflow.cpp index 53a24db..dcc9453 100644 --- a/Plugin/Workflow/Workflow.cpp +++ b/Plugin/Workflow/Workflow.cpp @@ -144,12 +144,17 @@ void Workflow::inlineMethodCalls(AnalysisContextRef ac) std::scoped_lock lock(g_initialAnalysisMutex); if (!GlobalState::hasAnalysisInfo(bv)) { + SharedAnalysisInfo info; CustomTypes::defineAll(bv); - auto file = std::make_shared(bv); - auto info = ObjectiveNinja::AnalysisProvider::infoForFile(file); + try { + auto file = std::make_shared(bv); + info = ObjectiveNinja::AnalysisProvider::infoForFile(file); - InfoHandler::applyInfoToView(info, bv); + InfoHandler::applyInfoToView(info, bv); + } catch (...) { + BinaryNinja::LogError("[Objective Ninja]: Error during analysis. Please report this bug!"); + } GlobalState::setFlag(bv, Flag::DidRunStructureAnalysis); GlobalState::storeAnalysisInfo(bv, info);