aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFJob.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2024-01-09 14:35:10 +0100
committerJay Berkenbilt <ejb@ql.org>2024-01-10 12:49:31 +0100
commit20a134826c6f33fab81b0cdb9ba2d75fb03d1b59 (patch)
tree21cb545861a09435dab3c91156ab23a175f27be5 /libqpdf/QPDFJob.cc
parent8b0ae8bb99e377979e692dea8d8de579dab64af5 (diff)
downloadqpdf-20a134826c6f33fab81b0cdb9ba2d75fb03d1b59.tar.zst
Fix arg parsing check with --collate
The check for the number of items was in the wrong place.
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r--libqpdf/QPDFJob.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 2e0abb43..3bdb4f39 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -2446,6 +2446,10 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea
auto n_collate = m->collate.size();
auto n_specs = parsed_specs.size();
+ if (!(n_collate == 0 || n_collate == 1 || n_collate == n_specs)) {
+ usage("--pages: if --collate has more than one value, it must have one value per page "
+ "specification");
+ }
if (n_collate > 0 && n_specs > 1) {
// Collate the pages by selecting one page from each spec in order. When a spec runs out of
// pages, stop selecting from it.