AK: Have JsonArray::set() change values instead of inserting values

Resolves #18618.

8134dcc changed `JsonArray::set()` to insert elements at an index
instead of changing existing elements in-place. Since no behavior
such as `Vector::try_at()` exists yet, it returns nothing.
This commit is contained in:
Kemal Zebari 2023-05-03 09:31:23 -07:00 committed by Sam Atkins
parent 590723aa3b
commit 582c55a1c8
2 changed files with 2 additions and 2 deletions

View file

@ -66,7 +66,7 @@ public:
void clear() { m_values.clear(); }
ErrorOr<void> append(JsonValue value) { return m_values.try_append(move(value)); }
ErrorOr<void> set(size_t index, JsonValue value) { return m_values.try_insert(index, move(value)); }
void set(size_t index, JsonValue value) { m_values.at(index) = move(value); }
template<typename Builder>
typename Builder::OutputType serialized() const;

View file

@ -97,7 +97,7 @@ ErrorOr<void> JsonArrayModel::set(int row, Vector<JsonValue>&& fields)
obj.set(field_spec.json_field_name, move(fields.at(i)));
}
TRY(m_array.set(row, move(obj)));
m_array.set(row, move(obj));
did_update();
return {};