mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Merge pull request #1231 from xiaoyifang/fix/dsl-crash
fix: dsl dictionary crash when creating full text index.
This commit is contained in:
commit
19fff3e445
|
@ -1150,10 +1150,11 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword,
|
|||
size_t begin = pos;
|
||||
|
||||
pos = articleData.find_first_of( U"\n\r", begin );
|
||||
if ( pos == wstring::npos )
|
||||
pos = articleData.size();
|
||||
|
||||
if ( articleHeadword.empty() ) {
|
||||
// Process the headword
|
||||
|
||||
articleHeadword = wstring( articleData, begin, pos - begin );
|
||||
|
||||
if ( insidedCard && !articleHeadword.empty() && isDslWs( articleHeadword[ 0 ] ) ) {
|
||||
|
@ -1195,12 +1196,12 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword,
|
|||
if ( articleData[ pos ] == '\r' )
|
||||
++pos;
|
||||
|
||||
if ( pos != articleData.size() ) {
|
||||
if ( pos < articleData.size() ) {
|
||||
if ( articleData[ pos ] == '\n' )
|
||||
++pos;
|
||||
}
|
||||
|
||||
if ( pos == articleData.size() ) {
|
||||
if ( pos >= articleData.size() ) {
|
||||
// Ok, it's end of article
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue