From 0eb8116998ffb68511198ada02e7fc3ae6e9c331 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 18 Feb 2009 13:24:47 +0100 Subject: [PATCH] Neither lose packages with empty name, nor SEGV when processing them. (bnc #470011) --- zypp/ResPoolProxy.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/zypp/ResPoolProxy.cc b/zypp/ResPoolProxy.cc index 756481f..5753475 100644 --- a/zypp/ResPoolProxy.cc +++ b/zypp/ResPoolProxy.cc @@ -108,30 +108,25 @@ namespace zypp const pool::PoolImpl::Id2ItemT & id2item( poolImpl_r.id2item() ); if ( ! id2item.empty() ) { - sat::detail::IdType cidx = sat::detail::noId; + // set startpoint pool::PoolImpl::Id2ItemT::const_iterator cbegin = id2item.begin(); for_( it, id2item.begin(), id2item.end() ) { - sat::detail::IdType idx( it->first ); - if ( idx != cidx ) + if ( it->first != cbegin->first ) { - // starting a new Selectable - if ( cidx ) - { - // create the previous one - ui::Selectable::Ptr p( makeSelectablePtr( cbegin, it ) ); - _selPool[p->kind()].push_back( p ); - _selIndex[cidx] = p; - } - cidx = idx; + // starting a new Selectable, create the previous one + ui::Selectable::Ptr p( makeSelectablePtr( cbegin, it ) ); + _selPool[p->kind()].push_back( p ); + _selIndex[cbegin->first] = p; + // remember new startpoint cbegin = it; } } // create the final one ui::Selectable::Ptr p( makeSelectablePtr( cbegin, id2item.end() ) ); _selPool[p->kind()].push_back( p ); - _selIndex[cidx] = p; + _selIndex[cbegin->first] = p; } } -- 2.7.4