diff --git a/sbin/nvmecontrol/nvmecontrol.c b/sbin/nvmecontrol/nvmecontrol.c index 52dccb411bf9..6c658d24b39c 100644 --- a/sbin/nvmecontrol/nvmecontrol.c +++ b/sbin/nvmecontrol/nvmecontrol.c @@ -75,6 +75,11 @@ dispatch(int argc, char *argv[], struct nvme_function *tbl) { struct nvme_function *f = tbl; + if (argv[1] == NULL) { + gen_usage(tbl); + return; + } + while (f->name != NULL) { if (strcmp(argv[1], f->name) == 0) f->fn(argc-1, &argv[1]);