http://bugzilla.lyx.org/show_bug.cgi?id=1793

Just checks if the cells are actually in the cache.

OK?
Jürgen
Index: math_nestinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_nestinset.C,v
retrieving revision 1.157
diff -p -u -r1.157 math_nestinset.C
--- math_nestinset.C	24 Jun 2005 10:14:33 -0000	1.157
+++ math_nestinset.C	25 Jun 2005 15:04:54 -0000
@@ -987,16 +987,22 @@ InsetBase * MathNestInset::editXY(LCurso
 	int idx_min = 0;
 	int dist_min = 1000000;
 	for (idx_type i = 0; i < nargs(); ++i) {
-		int d = cell(i).dist(x, y);
-		if (d < dist_min) {
-			dist_min = d;
-			idx_min = i;
+		if (theCoords.getArrays().has(&cell(i))) {
+			int d = cell(i).dist(x, y);
+			if (d < dist_min) {
+				dist_min = d;
+				idx_min = i;
+			}
 		}
 	}
 	MathArray const & ar = cell(idx_min);
+	pos_type pos = 0;
+	if (theCoords.getArrays().has(&ar)) {
+		pos = ar.x2pos(x - ar.xo());
+	}
 	cur.push(const_cast<MathNestInset&>(*this));
 	cur.idx() = idx_min;
-	cur.pos() = ar.x2pos(x - ar.xo());
+	cur.pos() = pos;
 	lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
 	if (dist_min == 0) {
 		// hit inside cell

Reply via email to