diff --git a/src/Common/ZooKeeper/TestKeeper.cpp b/src/Common/ZooKeeper/TestKeeper.cpp index 6e408750099..1b203d92fb8 100644 --- a/src/Common/ZooKeeper/TestKeeper.cpp +++ b/src/Common/ZooKeeper/TestKeeper.cpp @@ -433,7 +433,8 @@ std::pair TestKeeperMultiRequest::process(TestKeeper::Contain response.error = cur_response->error; for (auto it = undo_actions.rbegin(); it != undo_actions.rend(); ++it) - (*it)(); + if (*it) + (*it)(); return { std::make_shared(response), {} }; } @@ -447,7 +448,8 @@ std::pair TestKeeperMultiRequest::process(TestKeeper::Contain catch (...) { for (auto it = undo_actions.rbegin(); it != undo_actions.rend(); ++it) - (*it)(); + if (*it) + (*it)(); throw; } }