mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 12:56:23 +03: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
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/e72b14ef1d Pull-request: https://github.com/SerenityOS/serenity/pull/22938
@ -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 New Issue
Block a user