mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Some more unhandled exceptions in index search
This commit is contained in:
parent
8607af8d90
commit
7d167aedf8
49
btreeidx.cc
49
btreeidx.cc
|
@ -80,26 +80,39 @@ vector< WordArticleLink > BtreeIndex::findArticles( wstring const & str )
|
|||
{
|
||||
vector< WordArticleLink > result;
|
||||
|
||||
wstring folded = Folding::apply( str );
|
||||
if( folded.empty() )
|
||||
folded = Folding::applyWhitespaceOnly( str );
|
||||
|
||||
bool exactMatch;
|
||||
|
||||
vector< char > leaf;
|
||||
uint32_t nextLeaf;
|
||||
|
||||
char const * leafEnd;
|
||||
|
||||
char const * chainOffset = findChainOffsetExactOrPrefix( folded, exactMatch,
|
||||
leaf, nextLeaf,
|
||||
leafEnd );
|
||||
|
||||
if ( chainOffset && exactMatch )
|
||||
try
|
||||
{
|
||||
result = readChain( chainOffset );
|
||||
wstring folded = Folding::apply( str );
|
||||
if( folded.empty() )
|
||||
folded = Folding::applyWhitespaceOnly( str );
|
||||
|
||||
antialias( str, result );
|
||||
bool exactMatch;
|
||||
|
||||
vector< char > leaf;
|
||||
uint32_t nextLeaf;
|
||||
|
||||
char const * leafEnd;
|
||||
|
||||
char const * chainOffset = findChainOffsetExactOrPrefix( folded, exactMatch,
|
||||
leaf, nextLeaf,
|
||||
leafEnd );
|
||||
|
||||
if ( chainOffset && exactMatch )
|
||||
{
|
||||
result = readChain( chainOffset );
|
||||
|
||||
antialias( str, result );
|
||||
}
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
FDPRINTF( stderr, "Articles searching failed, error: %s\n", e.what() );
|
||||
result.clear();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
FDPRINTF( stderr, "Articles searching failed\n" );
|
||||
result.clear();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue