Only use result if we find a match

This commit is contained in:
craig.p.drummond
2013-05-28 19:09:18 +00:00
parent 7b82b49bd0
commit 4f2cdeb49a

View File

@@ -34,7 +34,9 @@
#include <QDebug>
//#define DBUG qWarning() << "WikipediaEngine"
#ifndef DBUG
#define DBUG qDebug()
#endif
static const char * constModeProperty="mode";
static const char * constRedirectsProperty="redirects";
@@ -480,7 +482,12 @@ void WikipediaEngine::getPage(const QStringList &query, Mode mode, const QString
}
// TODO: If we fail to find a match, prompt user???
const QString title=titles.takeAt(-1==index ? 0 : index);
if (-1==index) {
DBUG << __FUNCTION__ << "Failed to find match";
emit searchResult(QString(), QString());
return;
}
const QString title=titles.takeAt(index);
if (QLatin1String("List of CJK Unified Ideographs")==title) {
DBUG << __FUNCTION__ << "Unicode list?";