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:
Andreas Kling 2020-01-21 21:06:00 +01:00
parent ecd5589d4f
commit 82cb5b6f64
Notes: sideshowbarker 2024-07-19 09:54:36 +09:00

View file

@ -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())