Ensure increasing page range list
This commit is contained in:
parent
371c06b430
commit
f9b740c94b
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue