diff src/oct-map.cc @ 10763:b397b8edd8c5

fix off-by-1 dim in scalar map horzcat/vertcat
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 02 Jul 2010 08:10:57 +0200
parents 76079e505f9d
children e141bcb1befd
line wrap: on
line diff
--- a/src/oct-map.cc	Thu Jul 01 10:01:56 2010 +0200
+++ b/src/oct-map.cc	Fri Jul 02 08:10:57 2010 +0200
@@ -640,6 +640,13 @@
 octave_map::cat (int dim, octave_idx_type n, const octave_scalar_map *map_list)
 {
   octave_map retval;
+  // Allow dim = -1, -2 for compatibility, though it makes no difference here.
+  if (dim == -1 || dim == -2)
+    dim = -dim - 1;
+  else if (dim < 0)
+    (*current_liboctave_error_handler)
+      ("cat: invalid dimension");
+
   if (n > 0)
     {
       retval.xkeys = map_list[0].xkeys;