mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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:
parent
590723aa3b
commit
582c55a1c8
Notes:
sideshowbarker
2024-07-17 07:38:17 +09:00
Author: https://github.com/kemzeb Commit: https://github.com/SerenityOS/serenity/commit/582c55a1c8 Pull-request: https://github.com/SerenityOS/serenity/pull/18625 Issue: https://github.com/SerenityOS/serenity/issues/18618
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {};
|
||||
|
|
Loading…
Reference in a new issue