diff --git a/libinterp/corefcn/cellfun.cc b/libinterp/corefcn/cellfun.cc --- a/libinterp/corefcn/cellfun.cc +++ b/libinterp/corefcn/cellfun.cc @@ -558,7 +558,12 @@ nevermind: = get_output_list (es, count, nargout, inputlist, func, error_handler); - if (nargout > 0 && tmp.length () < nargout) + octave_idx_type tmp_len = tmp.length (); + + if (tmp_len == 0) + error ("cellfun: function must return value when UniformOutput is TRUE"); + + if (nargout > 0 && tmp_len < nargout) error ("cellfun: function returned fewer than nargout values"); if (nargout > 0