mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +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
Notes:
sideshowbarker
2024-07-17 18:46:30 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: 1ec0548158
Pull-request: https://github.com/SerenityOS/serenity/pull/16495
Reviewed-by: https://github.com/ADKaster ✅
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