diff liboctave/Array.cc @ 4876:05d464a13f43

[project @ 2004-04-22 19:38:14 by jwe]
author jwe
date Thu, 22 Apr 2004 19:38:14 +0000 (2004-04-22)
parents 2cbc6f37b0c2
children bbddd4339cf2
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -2004,7 +2004,7 @@
 
       if (len == 0 && idx_arg.one_zero_only ())
 	retval = Array<T> (tmp, dim_vector (0, 0));
-      else
+      else if (len >= idx_orig_dims.numel ())
 	retval = Array<T> (tmp, idx_orig_dims);
     }
   else if (nr == 1 || nc == 1)
@@ -2025,7 +2025,7 @@
 	  else
 	    retval = Array<T> (tmp, dim_vector (len, 1));
 	}
-      else
+      else if (len >= idx_orig_dims.numel ())
 	retval = Array<T> (tmp, idx_orig_dims);
     }
   else
@@ -2101,8 +2101,13 @@
 
       Array<T> tmp = Array<T>::index (ra_idx, resize_ok);
 
-      if (tmp.length () != 0)
-	retval = Array<T> (tmp, idx_orig_dims);
+      int len = tmp.length ();
+
+      if (len != 0)
+	{
+	  if (len >= idx_orig_dims.numel ())
+	    retval = Array<T> (tmp, idx_orig_dims);
+	}
       else
 	retval = Array<T> (tmp, dim_vector (0, 0));
     }
@@ -2154,7 +2159,7 @@
 
 	      retval = Array<T> (tmp, new_dims);
 	    }
-	  else
+	  else if (tmp.length () >= idx_orig_dims.numel ())
 	    retval = Array<T> (tmp, idx_orig_dims);
 
 	  (*current_liboctave_error_handler)