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
commit5c8793faf0c3ceee6ca534d0f69b417a3759f7af (patch)
treecba1ad072930f098dd9524c5359a684cf0afbeb4 /pw/pw.c
parent53d815d2b67ba1daf3d088e6049c75e9134228d2 (diff)
downloadpw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.tar.gz
pw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.tar.zst
pw-darwin-5c8793faf0c3ceee6ca534d0f69b417a3759f7af.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);