Skip to content

Commit

Permalink
Fix crash (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-gromeyer committed Nov 25, 2023
1 parent b9f5d36 commit 346fd6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ string formatMarkdownTable(const string &inputTable) {
// Determine maximum width of each column
vector<size_t> columnWidths(tableData[0].size(), 0);
for (const auto &row : tableData) {
if (columnWidths.size() < row.size()) {
columnWidths.resize(row.size(), 0);
}

for (size_t i = 0; i < row.size(); ++i) {
columnWidths[i] = std::max(columnWidths[i], row[i].size());
}
Expand Down

0 comments on commit 346fd6c

Please sign in to comment.