Commit 24d0c946 authored by David Thompson's avatar David Thompson

Fix `GroupItem::find()` for missing item names.

A missing item should not cause an assertion to fail.
parent bae5ba09
......@@ -286,9 +286,13 @@ smtk::attribute::ItemPtr GroupItem::find(std::size_t element, const std::string&
const GroupItemDefinition* def =
static_cast<const GroupItemDefinition*>(this->definition().get());
int i = def->findItemPosition(inName);
if (i < 0)
{
return smtk::attribute::ItemPtr();
}
assert(m_items.size() > element);
assert(m_items[element].size() > static_cast<std::size_t>(i));
return (i < 0) ? smtk::attribute::ItemPtr() : m_items[element][static_cast<std::size_t>(i)];
return m_items[element][static_cast<std::size_t>(i)];
}
smtk::attribute::ConstItemPtr GroupItem::find(std::size_t element, const std::string& inName) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment