null-pointer problem wenn SHORT_STRINGS aktiv

This commit is contained in:
Enno Rehling 2005-04-30 17:16:17 +00:00
parent 092b249060
commit 7e027ada71
1 changed files with 7 additions and 6 deletions

View File

@ -30,7 +30,8 @@ void
copy_order(order * dst, const order * src) copy_order(order * dst, const order * src)
{ {
if (dst->_str) free(dst->_str); if (dst->_str) free(dst->_str);
dst->_str = strdup(src->_str); if (src->_str) dst->_str = strdup(src->_str);
else dst->_str = NULL;
dst->_keyword = src->_keyword; dst->_keyword = src->_keyword;
dst->_lindex = src->_lindex; dst->_lindex = src->_lindex;
dst->_persistent = src->_persistent; dst->_persistent = src->_persistent;
@ -65,7 +66,7 @@ getcommand(const order * ord)
} }
} }
#endif #endif
strcpy(str, ord->_str); if (ord->_str) strcpy(str, ord->_str);
return strdup(sbuffer); return strdup(sbuffer);
} }