diff src/ov-cell.cc @ 8455:fd11a08a9b31

disallow invalid {}-indexed assigments
author Jaroslav Hajek <highegg@gmail.com>
date Sun, 11 Jan 2009 07:55:44 +0100
parents d6a349c7bd39
children c72207960242
line wrap: on
line diff
--- a/src/ov-cell.cc
+++ b/src/ov-cell.cc
@@ -268,9 +268,11 @@
 
 		octave_base_matrix<Cell>::assign (i, tmp_cell);
 	      }
-	    else
-              // Regularize a null matrix if stored into a struct component.
-	      octave_base_matrix<Cell>::assign (i, Cell (t_rhs.non_null_value ()));
+	    else if (i.all_scalars () || do_index_op (i, true).dims ().numel () == 1)
+              // Regularize a null matrix if stored into a cell.
+              octave_base_matrix<Cell>::assign (i, Cell (t_rhs.non_null_value ()));
+            else if (! error_state)
+              error ("scalar indices required for {} in assignment.");
 
 	    if (! error_state)
 	      {