diff --git a/src/core/ext/xds/xds_client.cc b/src/core/ext/xds/xds_client.cc index cc4dd5f0f875f..7b125b771d201 100644 --- a/src/core/ext/xds/xds_client.cc +++ b/src/core/ext/xds/xds_client.cc @@ -1420,11 +1420,11 @@ void XdsClient::ChannelState::LrsCallState::OnRequestSent(bool /*ok*/) { void XdsClient::ChannelState::LrsCallState::OnRecvMessage( absl::string_view payload) { MutexLock lock(&xds_client()->mu_); + // If we're no longer the current call, ignore the result. + if (!IsCurrentCallOnChannel()) return; // Start recv after any code branch auto cleanup = absl::MakeCleanup([call = call_.get()]() { call->StartRecvMessage(); }); - // If we're no longer the current call, ignore the result. - if (!IsCurrentCallOnChannel()) return; // Parse the response. bool send_all_clusters = false; std::set new_cluster_names;