mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 02:26:11 +00:00
HackStudio: Correct DeclarationsModel::row_count() calculation
No indices contain other indices, so the row count is 0 if the index is valid. This stops us infinitely recursing into non-existent indices.
This commit is contained in:
parent
44033415bc
commit
e72b14ef1d
|
@ -38,7 +38,14 @@ public:
|
|||
Filename,
|
||||
__Column_Count,
|
||||
};
|
||||
virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_declarations.size(); }
|
||||
|
||||
virtual int row_count(GUI::ModelIndex const& index = GUI::ModelIndex()) const override
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return m_declarations.size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Column_Count; }
|
||||
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role) const override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue