forked from github/server
segmentation fault caused by new getstrtoken semantics
This commit is contained in:
parent
86c2096cfa
commit
1c069da921
|
@ -2766,7 +2766,7 @@ static void breed_cmd(unit * u, struct order *ord)
|
||||||
(void)init_order(ord);
|
(void)init_order(ord);
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
|
|
||||||
m = atoi((const char *)s);
|
m = s ? atoi((const char *)s) : 0;
|
||||||
if (m != 0) {
|
if (m != 0) {
|
||||||
/* first came a want-paramter */
|
/* first came a want-paramter */
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
|
|
10
src/laws.c
10
src/laws.c
|
@ -3923,10 +3923,14 @@ void defaultorders(void)
|
||||||
order *ord = *ordp;
|
order *ord = *ordp;
|
||||||
if (getkeyword(ord) == K_DEFAULT) {
|
if (getkeyword(ord) == K_DEFAULT) {
|
||||||
char lbuf[8192];
|
char lbuf[8192];
|
||||||
order *new_order;
|
order *new_order = 0;
|
||||||
|
const char *s;
|
||||||
init_order(ord);
|
init_order(ord);
|
||||||
strcpy(lbuf, getstrtoken());
|
s = getstrtoken();
|
||||||
new_order = parse_order(lbuf, u->faction->locale);
|
if (s) {
|
||||||
|
strcpy(lbuf, s);
|
||||||
|
new_order = parse_order(lbuf, u->faction->locale);
|
||||||
|
}
|
||||||
*ordp = ord->next;
|
*ordp = ord->next;
|
||||||
ord->next = NULL;
|
ord->next = NULL;
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
Loading…
Reference in New Issue