mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 22:24:57 +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
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
Add a link
Reference in a new issue