diff --git a/lib/JIT.cpp b/lib/JIT.cpp index 9a0ed40..fb6814e 100644 --- a/lib/JIT.cpp +++ b/lib/JIT.cpp @@ -291,9 +291,11 @@ void JITImpl::reclaimUnreachableFunctions(JITCoreInfo &coreInfo) info->fastFuncValue }; for (LLVMValueRef f : functions) { - LLVMFreeMachineCodeForFunction(executionEngine, f); - LLVMReplaceAllUsesWith(f, LLVMGetUndef(LLVMTypeOf(f))); - LLVMDeleteFunction(f); + if(f){ + LLVMFreeMachineCodeForFunction(executionEngine, f); + LLVMReplaceAllUsesWith(f, LLVMGetUndef(LLVMTypeOf(f))); + LLVMDeleteFunction(f); + } } info->fastFunc = nullptr; info->func = nullptr;