[apps/shared] CurveView: avoid overflowing KDCoordinate

This fixes the following bug: add the sequence, u(n)=2^n. On the graph,
go to "sum of terms" and try to sum terms from 0 to 18 by moving the
cursor. It hangs.
This commit is contained in:
Émilie Feral
2020-10-06 16:36:52 +02:00
committed by LeaNumworks
parent 17fd1aea29
commit 8e025b0823

View File

@@ -426,6 +426,10 @@ void CurveView::drawHorizontalOrVerticalSegment(KDContext * ctx, KDRect rect, Ax
if (rect.intersects(lineRect)) {
ctx->fillRect(lineRect, color);
}
if (i > KDCOORDINATE_MAX - 2*dashSize) {
// Avoid overflowing KDCoordinate
break;
}
}
}