From be12b904128489a494157dd811fd8a7104e965bd Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 1 Mar 2018 15:17:57 -0800 Subject: [PATCH] Don't panic on cells with both a rowspan and colspan in include_sizes_from_previous_rows fixes #20162 --- components/layout/table_row.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index a332bc668ac..933d3be632e 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -123,7 +123,16 @@ impl TableRowFlow { if *span == 1 { break; } - let incoming = incoming_rowspan_data[*col]; + let incoming = if let Some(incoming) = incoming_rowspan_data.get(*col) { + *incoming + } else { + // This happens when we have a cell with both rowspan and colspan + // incoming_rowspan_data only records the data for the first column, + // but that's ok because we only need to account for each spanning cell + // once. So we skip ahead. + *col += 1; + continue; + }; *max_block_size = max(*max_block_size, incoming); *col += 1; }