fix:epwing navigation reference to invalid position

This commit is contained in:
xiaoyifang 2023-05-04 20:29:33 +08:00
parent 209b5e79da
commit bbec4685f8
2 changed files with 12 additions and 6 deletions

View file

@ -361,9 +361,7 @@ void EpwingDictionary::loadArticleNextPage(string & articleHeadword, string & ar
}
catch( std::exception & e )
{
text = QString( "Article reading error: %1")
.arg( QString::fromUtf8( e.what() ) );
articleText = string( text.toUtf8().data() );
qWarning() << QString( "Article reading error: %1" ).arg( QString::fromUtf8( e.what() ) );
return;
}
@ -399,8 +397,7 @@ void EpwingDictionary::loadArticlePreviousPage(
pos = eBook.getArticlePreviousPage( headword, text, articlePage, articleOffset, false );
}
catch( std::exception & e ) {
text = QString( "Article reading error: %1" ).arg( QString::fromUtf8( e.what() ) );
articleText = string( text.toUtf8().data() );
qDebug() << QString( "Article reading error: %1" ).arg( QString::fromUtf8( e.what() ) );
return;
}
@ -778,6 +775,15 @@ void EpwingArticleRequest::run()
dict.loadArticlePreviousPage( headword, articleText, articlePage, articleOffset );
}
//the reference may not contain valid text. at this point ,should return directly.
if ( articleText.empty() ) {
//clear result.
result.clear();
// No such word
finish();
return;
}
result += articleText;
}

2
thirdparty/eb vendored

@ -1 +1 @@
Subproject commit ec8904dc8b390b746573492806790cd11b164927
Subproject commit f45db88f160a9e597c3e050d37c011934fa5e773