diff liboctave/str-vec.cc @ 10477:a9649f994b07

avoid segfault in string_vector constructor
author John W. Eaton <jwe@octave.org>
date Tue, 30 Mar 2010 15:24:39 -0400
parents f9347eac65dc
children fd0a3ac60b0e
line wrap: on
line diff
--- a/liboctave/str-vec.cc
+++ b/liboctave/str-vec.cc
@@ -80,10 +80,13 @@
 {
   octave_idx_type n = 0;
 
-  const char * const *t = s;
+  if (s)
+    {
+      const char * const *t = s;
 
-  while (*t++)
-    n++;
+      while (*t++)
+        n++;
+    }
 
   resize (n);