changeset 7727:c8da61051ea2

idx-vector.cc: fix for-loop condition
author John W. Eaton <jwe@octave.org>
date Mon, 21 Apr 2008 11:51:34 -0400
parents 1b954fdaf4ff
children 13820b9f5fd9
files liboctave/ChangeLog liboctave/idx-vector.cc
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-21  John W. Eaton  <jwe@octave.org>
+
+	* idx-vector.cc (IDX_VEC_REP::idx_vector_rep (const boolNDArray&)):
+	Fix for-loop condition.
+
 2008-04-19  Jaroslav Hajek <highegg@gmail.com>
 
 	* CmplxCHOL.cc, CmplxQR.cc, dbleCHOL.cc, dbleQR.cc: Fix calls to error()
--- a/liboctave/idx-vector.cc
+++ b/liboctave/idx-vector.cc
@@ -281,7 +281,7 @@
 
       octave_idx_type ntot = bnda.length ();
 
-      for (octave_idx_type i = 0, k = 0; i < ntot; i++, k < len)
+      for (octave_idx_type i = 0, k = 0; i < ntot && k < len; i++)
 	if (bnda.elem (i))
 	  data[k++] = i;