Sat Dec 27 16:16:49 2003 Ben Pfaff <blp@gnu.org>
[pspp] / src / str.c
index 4bf2d60c67f1578629abe5cc56771b1d819b1b14..8912f3e58b6a4ec5921e58a952fd316dcb137560 100644 (file)
--- a/src/str.c
+++ b/src/str.c
@@ -18,6 +18,7 @@
    02111-1307, USA. */
 
 #include <config.h>
+#include "str.h"
 #include <assert.h>
 #include <ctype.h>
 #include <limits.h>
@@ -25,7 +26,6 @@
 #include "alloc.h"
 #include "error.h"
 #include "pool.h"
-#include "str.h"
 \f
 /* 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;