Mercurial > octave-nkf
diff libinterp/corefcn/cellfun.cc @ 20619:eef93a493ce3
use new cell_value method to handle value extraction errors
* cellfun.cc, ov-class.cc, ov-struct.cc, ov-usr-fcn.cc:
Use new cell_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Oct 2015 14:43:36 -0400 |
parents | 56fee8f84fe7 |
children |
line wrap: on
line diff
--- a/libinterp/corefcn/cellfun.cc Fri Oct 09 14:41:49 2015 -0400 +++ b/libinterp/corefcn/cellfun.cc Fri Oct 09 14:43:36 2015 -0400 @@ -2463,26 +2463,21 @@ if (args.length () >= 1) { - if (args(0).is_cell ()) - { - const Cell x = args(0).cell_value (); - NoAlias<Cell> y(x.dims ()); - octave_idx_type nel = x.numel (); - octave_value_list idx = args.slice (1, args.length () - 1); + const Cell x = args(0).cell_value ("cellindexmat: X must be a cell"); + NoAlias<Cell> y(x.dims ()); + octave_idx_type nel = x.numel (); + octave_value_list idx = args.slice (1, args.length () - 1); - for (octave_idx_type i = 0; i < nel; i++) - { - octave_quit (); - - octave_value tmp = x(i); + for (octave_idx_type i = 0; i < nel; i++) + { + octave_quit (); - y(i) = tmp.do_index_op (idx); - } + octave_value tmp = x(i); - retval = y; + y(i) = tmp.do_index_op (idx); } - else - error ("cellindexmat: X must be a cell"); + + retval = y; } else print_usage ();