changeset 20438:5b7d7051a032 stable

Fix hang when using errorbar with empty dataset (bug #45554). * __errcomm__.m: Use concatenation to append new errorbar plots to retval, rather than assignment which can fail if the RHS is empty. * __errplot__.m: 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:47:27 -0700
parents fc23fbe05f3a
children e3f84a8c6788 6947b9c82d4b
files scripts/plot/draw/private/__errcomm__.m scripts/plot/draw/private/__errplot__.m
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/private/__errcomm__.m	Sat Jul 25 20:16:58 2015 -0700
+++ b/scripts/plot/draw/private/__errcomm__.m	Tue Jul 28 08:47:27 2015 -0700
@@ -49,7 +49,7 @@
     while (k <= nargs)
       arg = varargin{k++};
       if (ischar (arg) || iscellstr (arg))
-        retval(end+1,1) = __errplot__(arg, hax, data{1:ndata});
+        retval = [retval; __errplot__(arg, hax, data{1:ndata})];
         break;
       endif
       if (! isnumeric (arg))
--- a/scripts/plot/draw/private/__errplot__.m	Sat Jul 25 20:16:58 2015 -0700
+++ b/scripts/plot/draw/private/__errplot__.m	Tue Jul 28 08:47:27 2015 -0700
@@ -48,7 +48,7 @@
   endswitch
 
   h = [];
-  nplots = columns (varargin{1});
+  nplots = ifelse (isempty (varargin{1}), 0, columns (varargin{1}));
   for i = 1:nplots
 
     if (isempty (fmt.color))
@@ -199,7 +199,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)