mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
Help: Only toggle open/close for SectionNodes
The responsible code was actually casting everything to a SectionNode pointer, violating type safety all over the place and leading to frequent crashes. I'm surprised this was not exhibited before; I guess my recent changes made this bug surface.
This commit is contained in:
parent
cf3b75e2e6
commit
1ec0548158
1 changed files with 3 additions and 2 deletions
|
@ -178,8 +178,9 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role
|
|||
|
||||
void ManualModel::update_section_node_on_toggle(const GUI::ModelIndex& index, bool const open)
|
||||
{
|
||||
auto* node = static_cast<Manual::SectionNode*>(index.internal_data());
|
||||
node->set_open(open);
|
||||
auto* node = static_cast<Manual::Node*>(index.internal_data());
|
||||
if (is<Manual::SectionNode>(*node))
|
||||
static_cast<Manual::SectionNode*>(node)->set_open(open);
|
||||
}
|
||||
|
||||
TriState ManualModel::data_matches(const GUI::ModelIndex& index, const GUI::Variant& term) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue