Commit Diff


commit - 7988c7a7cafa0919e92d4885f120536c80021c47
commit + 50e10c0364479a0d46c3c4958d2f99ed6c412aa6
blob - d9710d933043f1f0673ff657387184b53c1ec0ce
blob + 6416f700ed687760ca4a391fde869348b89f9840
--- complete.c
+++ complete.c
@@ -669,6 +669,8 @@ complete_nocmd(struct ghs *nocmd, char *word, int doli
 			if (c->nocmd || c->name == NULL /* sentinel */)
 				nocmdtab_nitems++;
 		}
+		if (nocmdtab_nitems == 0)
+			return (CC_ERROR);
 		nocmdtab = calloc(nocmdtab_nitems, sizeof(*nocmdtab));
 		if (nocmdtab == NULL)
 			return (CC_ERROR);