forked from github/server
Fix accidental parsing of empty strings (Bug 1917)
This commit is contained in:
parent
707262c61d
commit
2103c1725e
|
@ -2445,34 +2445,36 @@ static void reshow(unit * u, struct order *ord, const char *s, param_t p)
|
||||||
cmistake(u, ord, 285, MSG_EVENT);
|
cmistake(u, ord, 285, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
case NOPARAM:
|
case NOPARAM:
|
||||||
/* check if it's an item */
|
if (s) {
|
||||||
itype = finditemtype(s, u->faction->locale);
|
/* check if it's an item */
|
||||||
if (itype != NULL) {
|
itype = finditemtype(s, u->faction->locale);
|
||||||
ptype = resource2potion(item2resource(itype));
|
if (itype != NULL) {
|
||||||
if (ptype != NULL) {
|
ptype = resource2potion(item2resource(itype));
|
||||||
if (display_potion(u->faction, u, ptype))
|
if (ptype != NULL) {
|
||||||
break;
|
if (display_potion(u->faction, u, ptype))
|
||||||
} else {
|
break;
|
||||||
if (display_item(u->faction, u, itype))
|
} else {
|
||||||
break;
|
if (display_item(u->faction, u, itype))
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
/* try for a spell */
|
||||||
/* try for a spell */
|
sp = unit_getspell(u, s, u->faction->locale);
|
||||||
sp = unit_getspell(u, s, u->faction->locale);
|
if (sp) {
|
||||||
if (sp) {
|
attrib *a = a_find(u->faction->attribs, &at_seenspell);
|
||||||
attrib *a = a_find(u->faction->attribs, &at_seenspell);
|
while (a != NULL && a->type == &at_seenspell && a->data.v != sp) {
|
||||||
while (a != NULL && a->type == &at_seenspell && a->data.v != sp) {
|
a = a->next;
|
||||||
a = a->next;
|
}
|
||||||
|
if (a != NULL) {
|
||||||
|
a_remove(&u->faction->attribs, a);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (a != NULL) {
|
/* last, check if it's a race. */
|
||||||
a_remove(&u->faction->attribs, a);
|
rc = findrace(s, u->faction->locale);
|
||||||
|
if (rc != NULL && display_race(u->faction, u, rc)) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* last, check if it's a race. */
|
|
||||||
rc = findrace(s, u->faction->locale);
|
|
||||||
if (rc != NULL && display_race(u->faction, u, rc)) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
cmistake(u, ord, 21, MSG_EVENT);
|
cmistake(u, ord, 21, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1397,7 +1397,7 @@ param_t findparam(const char *s, const struct locale * lang)
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
char * str = transliterate(buffer, sizeof(buffer)-sizeof(int), s);
|
char * str = transliterate(buffer, sizeof(buffer)-sizeof(int), s);
|
||||||
|
|
||||||
if (str) {
|
if (str && *str) {
|
||||||
int i;
|
int i;
|
||||||
const void * match;
|
const void * match;
|
||||||
void **tokens = get_translations(lang, UT_PARAMS);
|
void **tokens = get_translations(lang, UT_PARAMS);
|
||||||
|
|
Loading…
Reference in New Issue