changeset 19424:68116bea38ba

Avoid duplicate error message when concatenating cell arrays with dim mismatch. * pt-mat.cc (tm_row_const::tm_row_const_rep::init): Check error state before continuing to process concatenation. Previous dimension check may already have printed a warning and set error_state variable.
author Rik <rik@octave.org>
date Sat, 06 Dec 2014 22:26:32 -0800
parents aea099cd1ee7
children 385499581a5e
files libinterp/parse-tree/pt-mat.cc
diffstat 1 files changed, 20 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-mat.cc	Thu Oct 09 20:01:09 2014 +0200
+++ b/libinterp/parse-tree/pt-mat.cc	Sat Dec 06 22:26:32 2014 -0800
@@ -387,27 +387,30 @@
 
   first_elem = true;
 
-  for (iterator p = begin (); p != end (); p++)
+  if (! error_state)
     {
-      octave_quit ();
-
-      octave_value val = *p;
-
-      dim_vector this_elt_dv = val.dims ();
-
-      if (! this_elt_dv.zero_by_zero ())
+      for (iterator p = begin (); p != end (); p++)
         {
-          all_mt = false;
+          octave_quit ();
+
+          octave_value val = *p;
 
-          if (first_elem)
+          dim_vector this_elt_dv = val.dims ();
+
+          if (! this_elt_dv.zero_by_zero ())
             {
-              first_elem = false;
-              dv = this_elt_dv;
-            }
-          else if ((! any_class) && (! dv.hvcat (this_elt_dv, 1)))
-            {
-              eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
-              break;
+              all_mt = false;
+
+              if (first_elem)
+                {
+                  first_elem = false;
+                  dv = this_elt_dv;
+                }
+              else if ((! any_class) && (! dv.hvcat (this_elt_dv, 1)))
+                {
+                  eval_error ("horizontal dimensions mismatch", dv, this_elt_dv);
+                  break;
+                }
             }
         }
     }