diff liboctave/str-vec.cc @ 12105:2641c6febd46 release-3-2-x

list_in_columns: Don't SIGFPE when given empty first argument
author David Grundberg <davidg@cs.umu.se>
date Wed, 25 Nov 2009 11:44:57 +0100
parents eb63fbe60fab
children
line wrap: on
line diff
--- a/liboctave/str-vec.cc	Tue Nov 24 08:04:51 2009 +0100
+++ b/liboctave/str-vec.cc	Wed Nov 25 11:44:57 2009 +0100
@@ -179,6 +179,14 @@
   octave_idx_type max_name_length = 0;
   octave_idx_type total_names = length ();
 
+  if (total_names == 0)
+    {
+      // List empty, remember to end output with a newline.
+
+      os << "\n";
+      return os;
+    }
+
   for (octave_idx_type i = 0; i < total_names; i++)
     {
       octave_idx_type name_length = elem (i).length ();