# HG changeset patch # User David Grundberg # Date 1259145897 -3600 # Node ID 2641c6febd46387f2df0c60979b47e5dc61e24dc # Parent 69828adba9665e5496a3ff747d02feedcce1a026 list_in_columns: Don't SIGFPE when given empty first argument diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-11-18 David Grundberg + + * str-vec.cc (string_vector::list_in_columns): Avoid crash on + empty arguments from list_in_columns. + 2009-10-27 David Bateman * SparsedbleLU.cc (SparseLU::SparseLU (const SparseMatrix&, diff --git a/liboctave/str-vec.cc b/liboctave/str-vec.cc --- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -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 ();