diff --git a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp index ac9e6bfebcd..f800c0832b5 100644 --- a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp +++ b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp @@ -867,10 +867,8 @@ bool DataReaderHistory::update_instance_nts( change->reader_info.no_writers_generation_count = vit->second->no_writers_generation_count; auto current_owner = vit->second->current_owner.first; - if (current_owner != previous_owner) + if ((current_owner != previous_owner) && (current_owner == change->writerGUID)) { - assert(current_owner == change->writerGUID); - // Remove all changes from different owners after the change. DataReaderInstance::ChangeCollection& changes = vit->second->cache_changes; auto it = std::lower_bound(changes.begin(), changes.end(), change, rtps::history_order_cmp);