Unverified Commit 72c459bc authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Fix crash when painting empty tables (#17952)

parent 4aa4c965
......@@ -1119,8 +1119,10 @@ class RenderTable extends RenderBox {
void paint(PaintingContext context, Offset offset) {
assert(_children.length == rows * columns);
if (rows * columns == 0) {
final Rect borderRect = new Rect.fromLTWH(offset.dx, offset.dy, size.width, 0.0);
border.paint(context.canvas, borderRect, rows: const <double>[], columns: const <double>[]);
if (border != null) {
final Rect borderRect = new Rect.fromLTWH(offset.dx, offset.dy, size.width, 0.0);
border.paint(context.canvas, borderRect, rows: const <double>[], columns: const <double>[]);
}
return;
}
assert(_rowTops.length == rows + 1);
......
......@@ -19,6 +19,14 @@ class TestStatefulWidgetState extends State<TestStatefulWidget> {
}
void main() {
testWidgets('Table widget - empty', (WidgetTester tester) async {
await tester.pumpWidget(
new Directionality(
textDirection: TextDirection.ltr,
child: new Table(),
),
);
});
testWidgets('Table widget - control test', (WidgetTester tester) async {
Future<Null> run(TextDirection textDirection) async {
await tester.pumpWidget(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment