Fix crash with short only option

This commit is contained in:
Jarryd Beck 2022-08-03 06:53:19 +10:00
parent 2abdd4af4d
commit 96e72f7d15

View File

@ -2628,8 +2628,8 @@ Options::help_one_group(const std::string& g) const
for (const auto& o : group->second.options) for (const auto& o : group->second.options)
{ {
assert(!o.l.empty()); if (o.l.size() &&
if (m_positional_set.find(o.l.front()) != m_positional_set.end() && m_positional_set.find(o.l.front()) != m_positional_set.end() &&
!m_show_positional) !m_show_positional)
{ {
continue; continue;
@ -2651,8 +2651,8 @@ Options::help_one_group(const std::string& g) const
auto fiter = format.begin(); auto fiter = format.begin();
for (const auto& o : group->second.options) for (const auto& o : group->second.options)
{ {
assert(!o.l.empty()); if (o.l.size() &&
if (m_positional_set.find(o.l.front()) != m_positional_set.end() && m_positional_set.find(o.l.front()) != m_positional_set.end() &&
!m_show_positional) !m_show_positional)
{ {
continue; continue;