mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibGUI: GFileSystemModel::index() now survives negative inputs
If asked to create an index with negative row and/or column, we should just return an invalid GModelIndex() instead of asserting.
This commit is contained in:
parent
ecd5589d4f
commit
82cb5b6f64
Notes:
sideshowbarker
2024-07-19 09:54:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/82cb5b6f640
1 changed files with 2 additions and 0 deletions
|
@ -297,6 +297,8 @@ const GFileSystemModel::Node& GFileSystemModel::node(const GModelIndex& index) c
|
|||
|
||||
GModelIndex GFileSystemModel::index(int row, int column, const GModelIndex& parent) const
|
||||
{
|
||||
if (row < 0 || column < 0)
|
||||
return {};
|
||||
auto& node = this->node(parent);
|
||||
const_cast<Node&>(node).reify_if_needed(*this);
|
||||
if (row >= node.children.size())
|
||||
|
|
Loading…
Add table
Reference in a new issue