summaryrefslogtreecommitdiffstats
path: root/pw/pw.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-07-12 00:02:43 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-07-12 00:02:43 +0000
commitdda50e62a030ac93fd85476aa0e75f27fa9c47eb (patch)
tree997b3e306011ecb9a3081d6e6c402951c3c4421d /pw/pw.c
parentfbab7d3255ef972d79ee2480df4dc928fd58d6e6 (diff)
downloadpw-darwin-dda50e62a030ac93fd85476aa0e75f27fa9c47eb.tar.gz
pw-darwin-dda50e62a030ac93fd85476aa0e75f27fa9c47eb.tar.zst
pw-darwin-dda50e62a030ac93fd85476aa0e75f27fa9c47eb.zip
Make getarg return NULL if args is NULL
Diffstat (limited to 'pw/pw.c')
-rw-r--r--pw/pw.c7
1 files changed, 6 insertions, 1 deletions
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);