Skip to content
Snippets Groups Projects
Commit 73fc3e36 authored by Peter Albrecht's avatar Peter Albrecht
Browse files

fix: undefined behaviour if shown description was not included in search

parent ffbe3356
No related branches found
No related tags found
1 merge request!406Refactor skill memory GUI
......@@ -31,9 +31,16 @@ namespace armarx::skills::gui
// construct skill id (with guaranteed valid provider)
skills::SkillID skillId = {provider_opt, _skillId.skillName};
// We assert that the skill exists
ARMARX_CHECK(skills.count(skillId.providerId.value()) > 0);
ARMARX_CHECK(skills.at(skillId.providerId.value()).count(skillId) > 0);
// Maybe the search doesn't include the shown skill?
if (skills.count(skillId.providerId.value()) == 0 ||
skills.at(skillId.providerId.value()).count(skillId) == 0)
{
// reset details widget
skillDetailsTreeWidget->resetWidget();
return;
}
// get skill description
skills::SkillDescription descr = skills.at(skillId.providerId.value()).at(skillId);
......
......@@ -34,9 +34,7 @@ namespace armarx::skills::gui
// dont touch the widget if the skill id didn't change
if (shownSkill.has_value() && skillId == shownSkill.value().skillId)
return;
this->clear();
aronTreeWidgetController = nullptr;
skillsArgumentsTreeWidgetItem = nullptr;
this->resetWidget();
{
auto it = new QTreeWidgetItem(
......@@ -154,5 +152,13 @@ namespace armarx::skills::gui
aronTreeWidgetController->setFromAron(data);
}
void
SkillDetailsTreeWidget::resetWidget()
{
this->clear();
aronTreeWidgetController = nullptr;
skillsArgumentsTreeWidgetItem = nullptr;
}
} // namespace armarx::skills::gui
......@@ -24,6 +24,8 @@ namespace armarx::skills::gui
void pasteCurrentConfig();
void resetCurrentConfig();
void resetWidget();
public slots:
void disconnectGui();
void updateGui();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment