Python module: avoid exception for 'for doc in q' where q is empty

This commit is contained in:
Jean-Francois Dockes 2019-02-20 18:32:56 +01:00
parent c93581201a
commit fe66ad214a

View File

@ -1075,7 +1075,7 @@ Query_iternext(PyObject *_self)
} }
int cnt = self->query->getResCnt(); int cnt = self->query->getResCnt();
if (cnt <= 0 || self->next < 0) { if (cnt <= 0 || self->next < 0) {
PyErr_SetString(PyExc_AttributeError, "query: no results"); // This happens if there are no results and is not an error
return 0; return 0;
} }
recoll_DocObject *result = recoll_DocObject *result =