From f9b740c94b3aa832a01f682c4cd09ab1b0112bb8 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Fri, 19 Aug 2022 18:32:06 +0200 Subject: [PATCH] Ensure increasing page range list --- src/rangelistchecker.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rangelistchecker.cpp b/src/rangelistchecker.cpp index 2674bfb..4b13027 100644 --- a/src/rangelistchecker.cpp +++ b/src/rangelistchecker.cpp @@ -33,9 +33,15 @@ QJsonArray RangeListChecker::parse(QString str) const PrintParameters params; params.setPageRange(str.toStdString()); QJsonArray ret; + size_t previous = 0; for(const std::pair& p : params.pageRangeList) { + if(p.first <= previous) + { + return {}; + } ret.append(QJsonObject {{"low", int(p.first)}, {"high", int(p.second)}}); + previous = p.second; } return ret; }