X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fstr.c;h=8912f3e58b6a4ec5921e58a952fd316dcb137560;hb=3a7fba81ceae5b049d0f7d671e9e3c3c43bbf703;hp=4bf2d60c67f1578629abe5cc56771b1d819b1b14;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/str.c b/src/str.c index 4bf2d60c67..8912f3e58b 100644 --- a/src/str.c +++ b/src/str.c @@ -18,6 +18,7 @@ 02111-1307, USA. */ #include +#include "str.h" #include #include #include @@ -25,7 +26,6 @@ #include "alloc.h" #include "error.h" #include "pool.h" -#include "str.h" /* sprintf() wrapper functions for convenience. */ @@ -331,7 +331,11 @@ ds_end (const struct string *st) void ds_concat (struct string *st, const char *s) { - size_t s_len = strlen (s); + size_t s_len; + + if (!s) return; + + s_len = strlen (s); ds_extend (st, st->length + s_len); strcpy (st->string + st->length, s); st->length += s_len;