diff options
Diffstat (limited to 'source/pdf/pdf-page.c')
-rw-r--r-- | source/pdf/pdf-page.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c index 0828ec7bb..808864358 100644 --- a/source/pdf/pdf-page.c +++ b/source/pdf/pdf-page.c @@ -1492,11 +1492,10 @@ void pdf_delete_page_range(fz_context *ctx, pdf_document *doc, int start, int end) { int count = pdf_count_pages(ctx, doc); - - if (end < 0 || end > count) - end = count+1; - if (start < 0) - start = 0; + if (end < 0) + end = count; + start = fz_clampi(start, 0, count); + end = fz_clampi(end, 0, count); while (start < end) { pdf_delete_page(ctx, doc, start); |