@@ -104,19 +104,20 @@ def start_ai_decompiler(self, bv: BinaryView, options: Dict) -> None:
104104 if poll_status .lower () != "completed" and poll_status .lower () != "failed" :
105105 log_info (f"RevEng.AI | Starting AI Decompilation for function at 0x{ function .start :x} " )
106106
107- try :
108- with revengai .ApiClient (self .config .api_config ) as api_client :
109- api_instance = revengai .FunctionsAIDecompilationApi (api_client )
110- api_response_status = api_instance .create_ai_decompilation_task (function_id )
111- log_info (f"RevEng.AI | AI Decompilation task created for function at 0x{ function .start :x} " )
112- if not api_response_status .status :
113- callback (editor , "AI Decompilation failed." )
114- return
115-
116- except Exception as e :
117- log_error (f"RevEng.AI | Error beginning AI decompilation: { str (e )} " )
118- callback (editor , "AI Decompilation failed." )
119- return
107+ if poll_status .lower () == "uninitialised" :
108+ try :
109+ with revengai .ApiClient (self .config .api_config ) as api_client :
110+ api_instance = revengai .FunctionsAIDecompilationApi (api_client )
111+ api_response_status = api_instance .create_ai_decompilation_task (function_id )
112+ log_info (f"RevEng.AI | AI Decompilation task created for function at 0x{ function .start :x} " )
113+ if not api_response_status .status :
114+ callback (editor , "AI Decompilation failed." )
115+ return
116+
117+ except Exception as e :
118+ log_error (f"RevEng.AI | Error beginning AI decompilation: { str (e )} " )
119+ callback (editor , "AI Decompilation failed." )
120+ return
120121
121122 log_info ("RevEng.AI | AI Decompilation started" )
122123 periodic_checker = AIDecompilerChecker ()
0 commit comments