Ensure increasing page range list

This commit is contained in:
Anton Thomasson 2022-08-19 18:32:06 +02:00
parent 371c06b430
commit f9b740c94b

View file

@ -33,9 +33,15 @@ QJsonArray RangeListChecker::parse(QString str) const
PrintParameters params; PrintParameters params;
params.setPageRange(str.toStdString()); params.setPageRange(str.toStdString());
QJsonArray ret; QJsonArray ret;
size_t previous = 0;
for(const std::pair<size_t, size_t>& p : params.pageRangeList) for(const std::pair<size_t, size_t>& p : params.pageRangeList)
{ {
if(p.first <= previous)
{
return {};
}
ret.append(QJsonObject {{"low", int(p.first)}, {"high", int(p.second)}}); ret.append(QJsonObject {{"low", int(p.first)}, {"high", int(p.second)}});
previous = p.second;
} }
return ret; return ret;
} }