mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
Spreadsheet: Accept (and ignore) invalid 'columns' in json
The save functionality omits these when the names are standard, so just ignore them if they don't exist (or are not valid).
This commit is contained in:
parent
e8e8d3caf5
commit
28428beb5c
1 changed files with 6 additions and 6 deletions
|
@ -373,8 +373,6 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
|||
auto sheet = adopt(*new Sheet(workbook));
|
||||
auto rows = object.get("rows").to_u32(default_row_count);
|
||||
auto columns = object.get("columns");
|
||||
if (!columns.is_array())
|
||||
return nullptr;
|
||||
auto name = object.get("name").as_string_or("Sheet");
|
||||
|
||||
sheet->set_name(name);
|
||||
|
@ -383,10 +381,12 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
|||
sheet->add_row();
|
||||
|
||||
// FIXME: Better error checking.
|
||||
columns.as_array().for_each([&](auto& value) {
|
||||
sheet->m_columns.append(value.as_string());
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
if (columns.is_array()) {
|
||||
columns.as_array().for_each([&](auto& value) {
|
||||
sheet->m_columns.append(value.as_string());
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
if (sheet->m_columns.size() < default_column_count && sheet->columns_are_standard()) {
|
||||
for (size_t i = sheet->m_columns.size(); i < default_column_count; ++i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue