changeset 20439:d8535ec99c86

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.
author Rik <rik@octave.org>
date Tue, 28 Jul 2015 08:50:55 -0700
parents be6720faab96
children e3f84a8c6788
files scripts/plot/draw/private/__errplot__.m
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)