From d34ec05cc261640694b9c186eb853a89bf18c2f5 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Thu, 3 Dec 2009 12:43:35 +0100 Subject: [PATCH] Avoid null items in picklist --- zypp/ui/SelectableImpl.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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; } ///////////////////////////////////////////////////////////////// -- 2.7.4