From 5c8793faf0c3ceee6ca534d0f69b417a3759f7af Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sun, 12 Jul 2015 00:02:43 +0000 Subject: Make getarg return NULL if args is NULL --- pw/pw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pw/pw.c') diff --git a/pw/pw.c b/pw/pw.c index 3d4fcf2..532d77b 100644 --- a/pw/pw.c +++ b/pw/pw.c @@ -582,7 +582,12 @@ cmdhelp(int mode, int which) struct carg * getarg(struct cargs * _args, int ch) { - struct carg *c = LIST_FIRST(_args); + struct carg *c; + + if (_args == NULL) + return (NULL); + + c = LIST_FIRST(_args); while (c != NULL && c->ch != ch) c = LIST_NEXT(c, list); -- cgit v1.2.3-56-ge451