1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Help: Use array size instead of sizeof to determine number of sections

This was a relict when the sections were still a help-internal array.
This commit is contained in:
kleines Filmröllchen 2022-12-14 13:23:02 +01:00 committed by Andrew Kaster
parent 1ec0548158
commit 437d3ca0ea

View file

@ -123,7 +123,7 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const
return {};
if (parent->parent() == nullptr) {
for (size_t row = 0; row < sizeof(Manual::sections) / sizeof(Manual::sections[0]); row++)
for (size_t row = 0; row < Manual::sections.size(); row++)
if (Manual::sections[row].ptr() == parent)
return create_index(row, 0, parent);
VERIFY_NOT_REACHED();
@ -139,7 +139,7 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const
int ManualModel::row_count(const GUI::ModelIndex& index) const
{
if (!index.is_valid())
return sizeof(Manual::sections) / sizeof(Manual::sections[0]);
return static_cast<int>(Manual::sections.size());
auto* node = static_cast<Manual::Node const*>(index.internal_data());
return node->children().size();
}