# HG changeset patch # User David Grundberg # Date 1258555854 -3600 # Node ID 737624cb75601d5d0ee9001f2bb53bbcc1d06ca4 # Parent 6748616e2f8b90b3428928729c4d38f0468790a6 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-11-18 Jaroslav Hajek * Sparse.h (read_sparse_matrix): Fix order of tests and reads. diff --git a/liboctave/str-vec.cc b/liboctave/str-vec.cc --- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -197,6 +197,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 ();