Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 0da1a7e

Browse files
Googlerstuartmorgan-g
Googler
authored andcommitted
Fix exception caused by null y coordinate.
PiperOrigin-RevId: 393199512
1 parent 71407b6 commit 0da1a7e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

charts_common/lib/src/chart/line/line_renderer.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,13 +1185,16 @@ class LineRenderer<D> extends BaseCartesianRenderer<D> {
11851185
: null;
11861186
}
11871187
var limit = chartPoint.y;
1188-
if (leftPoint != null && rightPoint != null) {
1188+
if (leftPoint != null &&
1189+
leftPoint.y != null &&
1190+
rightPoint != null &&
1191+
rightPoint.y != null) {
11891192
var slope =
11901193
(rightPoint.y! - leftPoint.y!) / (rightPoint.x! - leftPoint.x!);
11911194
limit = (chartPoint.x - leftPoint.x!) * slope + leftPoint.y!;
1192-
} else if (leftPoint != null) {
1195+
} else if (leftPoint != null && leftPoint.y != null) {
11931196
limit = leftPoint.y!;
1194-
} else if (rightPoint != null) {
1197+
} else if (rightPoint != null && rightPoint.y != null) {
11951198
limit = rightPoint.y!;
11961199
}
11971200

0 commit comments

Comments
 (0)