diff options
-rw-r--r-- | kmail/index.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/kmail/index.cpp b/kmail/index.cpp index f9b157d2..2d1ef081 100644 --- a/kmail/index.cpp +++ b/kmail/index.cpp @@ -451,19 +451,21 @@ bool KMMsgIndex::stopQuery( KMSearch* s ) { std::vector<TQ_UINT32> KMMsgIndex::simpleSearch( TQString s, bool* ok ) const { kdDebug( 5006 ) << "KMMsgIndex::simpleSearch( -" << s.latin1() << "- )" << endl; + if ( ok ) *ok = false; if ( mState == s_error || mState == s_disabled ) { - if ( ok ) *ok = false; return std::vector<TQ_UINT32>(); } std::vector<TQ_UINT32> res; #ifdef HAVE_INDEXLIB - assert( mIndex ); - std::vector<unsigned> residx = mIndex->search( s.latin1() )->list(); - res.reserve( residx.size() ); - for ( std::vector<unsigned>::const_iterator first = residx.begin(), past = residx.end();first != past; ++first ) { - res.push_back( std::atoi( mIndex->lookup_docname( *first ).c_str() ) ); + if (mIndex) + { + std::vector<unsigned> residx = mIndex->search( s.latin1() )->list(); + res.reserve( residx.size() ); + for ( std::vector<unsigned>::const_iterator first = residx.begin(), past = residx.end();first != past; ++first ) { + res.push_back( std::atoi( mIndex->lookup_docname( *first ).c_str() ) ); + } + if ( ok ) *ok = true; } - if ( ok ) *ok = true; #endif return res; } |