diff --git a/ODTKRA/Main.cpp b/ODTKRA/Main.cpp index 18411f5..76d45d7 100644 --- a/ODTKRA/Main.cpp +++ b/ODTKRA/Main.cpp @@ -156,11 +156,16 @@ int main(int argc, char* argv[]) { Sleep(60000); if (GetTickCount() - GetIdleTime() > 54000 && GetTickCount() - last_time_restarted > 1800000) { - killODT(0); - start_ODT(hWindowHandle, Target_window_Name); //restart ODT becuase it has a fucking memory leak - std::cout << "ODT restarted at " << st.wHour << ":" << st.wMinute << std::endl; - - last_time_restarted = GetTickCount(); + if (check_ODT()) { + std::cout << "ODT restarted at " << st.wHour << ":" << st.wMinute << std::endl; + + last_time_restarted = GetTickCount(); + } + else { + killODT(0); + Sleep(10000); + start_ODT(hWindowHandle, Target_window_Name); //restart ODT becuase it has a fucking memory leak + } } } }