diff --git a/libdnf5/rpm/solv/goal_private.cpp b/libdnf5/rpm/solv/goal_private.cpp index 12cc29cc35..89da492ca8 100644 --- a/libdnf5/rpm/solv/goal_private.cpp +++ b/libdnf5/rpm/solv/goal_private.cpp @@ -571,8 +571,7 @@ libdnf5::GoalProblem GoalPrivate::protected_in_removals() { return ret; } auto removes = list_removes(); - auto obsoleted = list_obsoleted(); - if (removes.empty() && obsoleted.empty()) { + if (removes.empty()) { removal_of_protected.reset(); return ret; } @@ -580,11 +579,8 @@ libdnf5::GoalProblem GoalPrivate::protected_in_removals() { auto & pool = get_rpm_pool(); libdnf5::solv::SolvMap pkg_remove_list(pool->nsolvables); - for (auto index = 0; index < removes.size(); ++index) { - pkg_remove_list.add_unsafe(removes[index]); - } - for (auto index = 0; index < obsoleted.size(); ++index) { - pkg_remove_list.add_unsafe(obsoleted[index]); + for (const auto & remove : removes) { + pkg_remove_list.add_unsafe(remove); } libdnf5::solv::SolvMap protected_pkgs(pool->nsolvables);