From: Michael Andres Date: Thu, 3 Dec 2009 11:43:35 +0000 (+0100) Subject: Avoid null items in picklist X-Git-Tag: 6.27.0~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d34ec05cc261640694b9c186eb853a89bf18c2f5;p=platform%2Fupstream%2Flibzypp.git Avoid null items in picklist --- diff --git a/zypp/ui/SelectableImpl.h b/zypp/ui/SelectableImpl.h index f8f1fd5..54bb1e8 100644 --- a/zypp/ui/SelectableImpl.h +++ b/zypp/ui/SelectableImpl.h @@ -253,7 +253,7 @@ namespace zypp { if ( ! _picklistPtr ) { - _picklistPtr.reset( new PickList( _availableItems.size() ) ); + _picklistPtr.reset( new PickList ); // installed without identical avaialble first: for_( it, _installedItems.begin(), _installedItems.end() ) { @@ -467,6 +467,31 @@ namespace zypp str << "} "; } + if ( obj.picklistEmpty() ) + { + str << "(P 0) {}"; + } + else + { + PoolItem cand( obj.candidateObj() ); + PoolItem up( obj.updateCandidateObj() ); + str << "(P " << obj.picklistSize() << ") {" << endl; + for_( it, obj.picklistBegin(), obj.picklistEnd() ) + { + char t = ' '; + if ( *it == cand ) + { + t = *it == up ? 'C' : 'c'; + } + else if ( *it == up ) + { + t = 'u'; + } + str << " " << t << " " << *it << "\t" << obj.pickStatus( *it ) << endl; + } + str << "} "; + } + return str; } /////////////////////////////////////////////////////////////////