diff --git a/src/economy.c b/src/economy.c index 8819f0fd4..86fb14a3d 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2768,7 +2768,7 @@ static void breed_cmd(unit * u, struct order *ord) skip_token(); s = getstrtoken(); - m = atoi((const char *)s); + m = s ? atoi((const char *)s) : 0; if (m != 0) { /* first came a want-paramter */ s = getstrtoken(); diff --git a/src/laws.c b/src/laws.c index fe2ec329b..505dd91a7 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3942,11 +3942,14 @@ void defaultorders(void) order *ord = *ordp; if (getkeyword(ord) == K_DEFAULT) { char lbuf[8192]; - order *new_order; - init_tokens(ord); - skip_token(); /* skip the keyword */ - strcpy(lbuf, getstrtoken()); - new_order = parse_order(lbuf, u->faction->locale); + order *new_order = 0; + const char *s; + init_order(ord); + s = getstrtoken(); + if (s) { + strcpy(lbuf, s); + new_order = parse_order(lbuf, u->faction->locale); + } *ordp = ord->next; ord->next = NULL; free_order(ord);