From bug-request at octave dot org Tue Apr 19 09:58:14 2005 Subject: () should just give a error but goes to panic: From: "John W. Eaton" To: Etienne de Foras Cc: bug at octave dot org Date: Tue, 19 Apr 2005 10:56:51 -0400 On 19-Apr-2005, Etienne de Foras wrote: | Hello, | | Just a bug: | | u=rand(10,10); | u()=0 gives an error => ok. | | u=rand(10,10,10); (ND-Matrix) | u()=0 hangs up and return to prompt, normal feeling? | | Thanks and See you. | | version=2.1.67 Please try the following patch. Thanks, jwe liboctave/ChangeLog: 2005-04-19 John W. Eaton * Array.cc (assignN): Don't crash if the index list is empty. Index: liboctave/Array.cc =================================================================== RCS file: /usr/local/cvsroot/octave/liboctave/Array.cc,v retrieving revision 1.124.2.3 diff -u -r1.124.2.3 Array.cc --- liboctave/Array.cc 1 Apr 2005 18:22:47 -0000 1.124.2.3 +++ liboctave/Array.cc 19 Apr 2005 14:44:17 -0000 at @ -2899,6 +2899,13 @@ { lhs.maybe_delete_elements (idx, rfv); } + else if (n_idx == 0) + { + (*current_liboctave_error_handler) + ("invalid number of indices for matrix expression"); + + retval = 0; + } else if (n_idx == 1) { idx_vector iidx = idx(0); ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------