Skip to content

Commit

Permalink
fix: guard against an empty list of tables
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Oct 30, 2023
1 parent b0cc7ad commit c3db031
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import {
StackedRawSeries,
StackedSeries,
} from "./StackedConstants"
import { OwidTable, CoreColumn } from "@ourworldindata/core-table"
import {
OwidTable,
CoreColumn,
BlankOwidTable,
} from "@ourworldindata/core-table"
import {
autoDetectSeriesStrategy,
autoDetectYColumnSlugs,
Expand Down Expand Up @@ -103,6 +107,9 @@ export class AbstractStackedChart
.map((t: OwidTable) =>
t.dropRowsWithErrorValuesForAnyColumn(this.yColumnSlugs)
)

if (groupedByEntity.length === 0) return BlankOwidTable()

table = groupedByEntity[0].concat(groupedByEntity.slice(1))
}

Expand Down

0 comments on commit c3db031

Please sign in to comment.