fix null-pointer crash.

This commit is contained in:
Enno Rehling 2014-08-24 00:29:19 +02:00
parent b2dc6a3a9d
commit f1d78b4b84
1 changed files with 2 additions and 1 deletions

View File

@ -541,7 +541,8 @@ char *write_order(const order * ord, char *buffer, size_t size)
keyword_t kwd = ORD_KEYWORD(ord); keyword_t kwd = ORD_KEYWORD(ord);
if (kwd == NOKEYWORD) { if (kwd == NOKEYWORD) {
const char *text = ORD_STRING(ord); const char *text = ORD_STRING(ord);
strlcpy(buffer, (const char *)text, size); if (text) strlcpy(buffer, (const char *)text, size);
else buffer[0] = 0;
} }
else { else {
get_command(ord, buffer, size); get_command(ord, buffer, size);