mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +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,
|
Filename,
|
||||||
__Column_Count,
|
__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 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;
|
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role) const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue