Fix a segfault if 'wear' is used without an argument or with

an argument that is not a valid word from the battlestar dictionary.

PR:		36992
Submitted by:	Ceri Davies <ceri@FreeBSD.org>
Reviewed by:	dd
Approved by:	dd, silence on -audit
MFC after:	2 weeks
This commit is contained in:
Peter Pentchev 2002-04-15 17:27:34 +00:00
parent c58d96bb2f
commit 7664eb8fc2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94784

View File

@ -51,13 +51,12 @@ wearit() /* synonyms = {sheathe, sheath} */
while(wordtype[++wordnumber] == ADJS);
while(wordnumber <= wordcount){
value = wordvalue[wordnumber];
if (value == -1) {
puts("Wear what?");
return (firstnumber);
}
for (n=0; objsht[value][n]; n++);
switch(value){
case -1:
puts("Wear what?");
return(firstnumber);
default:
printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]);
return(firstnumber);