# HG changeset patch # User Rik # Date 1438098655 25200 # Node ID d8535ec99c86fb622b10c3f79d38584a3ae2dca6 # Parent be6720faab96feaaa383b9f93905c3a06c3a1002 Fix hang when using errorbar with empty dataset (bug #45554). * __errplot__.m: Use concatenation to append new errorbar plots to retval, rather than assignment which can fail if the RHS is empty. * __errplot__(__do_errplot__): Determine number of plots by checking number of columns in dataset, but only if dataset is not empty (row is zero for example). Only process a legend key if the number of plots is greater than 0. diff -r be6720faab96 -r d8535ec99c86 scripts/plot/draw/private/__errplot__.m --- a/scripts/plot/draw/private/__errplot__.m Mon Jul 27 21:11:17 2015 -0400 +++ b/scripts/plot/draw/private/__errplot__.m Tue Jul 28 08:50:55 2015 -0700 @@ -48,7 +48,7 @@ while (k <= nargs) arg = varargin{k++}; if (ischar (arg) || iscellstr (arg)) - retval(end+1,1) = __do_errplot__(arg, hax, data{1:ndata}); + retval = [retval; __do_errplot__(arg, hax, data{1:ndata})]; break; endif if (! isnumeric (arg)) @@ -100,7 +100,7 @@ endswitch h = []; - nplots = columns (varargin{1}); + nplots = ifelse (isempty (varargin{1}), 0, columns (varargin{1})); for i = 1:nplots if (isempty (fmt.color)) @@ -251,7 +251,7 @@ endfor ## Process legend key - if (! isempty (fmt.key)) + if (! isempty (fmt.key) && nplots > 0) hlegend = []; fkids = get (gcf (), "children"); for i = 1 : numel (fkids)