Add null check to _IndicatorPainter._tabOffsetsEqual() to prevent crash (#40009)

* Add tabOffsetEqual null check with TODO
This commit is contained in:
Shi-Hao Hong
2019-09-09 21:12:27 -07:00
committed by GitHub
parent 45d57e780f
commit 2449928d7c

View File

@@ -419,7 +419,9 @@ class _IndicatorPainter extends CustomPainter {
}
static bool _tabOffsetsEqual(List<double> a, List<double> b) {
if (a?.length != b?.length)
// TODO(shihaohong): The following null check should be replaced when a fix
// for https://github.com/flutter/flutter/issues/40014 is available.
if (a == null || b == null || a.length != b.length)
return false;
for (int i = 0; i < a.length; i += 1) {
if (a[i] != b[i])