Unnecessarily stringent test on reslist href format broke spelling replacement

This commit is contained in:
Jean-Francois Dockes 2020-11-17 17:39:07 +01:00
parent 6b7f2ff876
commit f4922687b4

View File

@ -974,8 +974,6 @@ void ResList::onLinkClicked(const QUrl &qurl)
}
strurl = strurl.substr(m_pager->linkPrefix().size());
// The content of our URLs is always a single letter possibly
// followed by an integer value (document number).
if (strurl.size() == 0) {
return;
}
@ -983,21 +981,16 @@ void ResList::onLinkClicked(const QUrl &qurl)
bool havedoc{false};
Rcl::Doc doc;
if (strurl.size() > 1) {
// Expecting integer after the letter, and nothing else
// If an integer follows interpret as doc number
const char *bptr = strurl.c_str() + 1;
char *eptr;
docnum = strtol(bptr, &eptr, 10) - 1;
if (eptr == bptr || *eptr != 0) {
// No digits or non-digit characters following digits, bad link.
return;
}
if (docnum >= 0) {
if (getDoc(docnum, doc)) {
havedoc = true;
} else {
LOGERR("ResList::onLinkClicked: can't get doc for "<<
docnum << "\n");
return;
}
}
}