diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp index 7527b3b3b0879d..4a7b7b499135ff 100644 --- a/cloud/src/recycler/recycler.cpp +++ b/cloud/src/recycler/recycler.cpp @@ -2967,7 +2967,7 @@ int InstanceRecycler::scan_and_recycle( }; std::unique_ptr it; - do { + while (it == nullptr /* may be not init */ || (it->more() && !stopped())) { if (get_range_retried > 1000) { err = "txn_get exceeds max retry, may not scan all keys"; ret = -1; @@ -3006,7 +3006,7 @@ int InstanceRecycler::scan_and_recycle( err = "loop_done error"; ret = -1; } - } while (it->more() && !stopped()); + } return ret; }