From fb38ea53371d1dab1bcc72411b058134db8d425c Mon Sep 17 00:00:00 2001 From: giraffedata Date: Tue, 19 Dec 2023 18:58:40 +0000 Subject: Check arguments for zero git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4813 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/specialty/pnmindex.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'editor') diff --git a/editor/specialty/pnmindex.c b/editor/specialty/pnmindex.c index 86b70f42..d6c1764d 100644 --- a/editor/specialty/pnmindex.c +++ b/editor/specialty/pnmindex.c @@ -162,13 +162,22 @@ parseCommandLine(int argc, const char ** argv, if (quant && cmdlineP->noquant) pm_error("You can't specify both -quant and -noquat"); - if (!colorsSpec) + if (colorsSpec) { + if (cmdlineP->colors == 0) + pm_error("-colors value must be positive"); + } else cmdlineP->colors = 256; - if (!sizeSpec) + if (sizeSpec) { + if (cmdlineP->size == 0) + pm_error("-size value must be positive"); + } else cmdlineP->size = 100; - if (!acrossSpec) + if (acrossSpec) { + if (cmdlineP->across == 0) + pm_error("-across value must be positive"); + } else cmdlineP->across = 6; if (!titleSpec) -- cgit 1.4.1