fix crashbug DEFAULT

This commit is contained in:
Enno Rehling 2005-06-03 16:05:54 +00:00
parent 98f69670ab
commit cffaedc001
1 changed files with 4 additions and 2 deletions

View File

@ -3711,17 +3711,19 @@ defaultorders (void)
order * ord = *ordp; order * ord = *ordp;
if (get_keyword(ord)==K_DEFAULT) { if (get_keyword(ord)==K_DEFAULT) {
char * cmd; char * cmd;
order * new_order;
init_tokens(ord); init_tokens(ord);
skip_token(); /* skip the keyword */ skip_token(); /* skip the keyword */
cmd = strdup(getstrtoken()); cmd = strdup(getstrtoken());
new_order = parse_order(cmd, u->faction->locale);
#ifdef LASTORDER #ifdef LASTORDER
set_order(&u->lastorder, parse_order(cmd, u->faction->locale)); if (new_order) set_order(&u->lastorder, new_order);
#else #else
if (!neworders) { if (!neworders) {
neworders = true; neworders = true;
free_orders(&u->old_orders); free_orders(&u->old_orders);
} }
addlist(&u->old_orders, parse_order(cmd, u->faction->locale)); if (new_order) addlist(&u->old_orders, new_order);
#endif #endif
free(cmd); free(cmd);
*ordp = ord->next; *ordp = ord->next;