Commit 96e72f7d1509cd0e33148b7f7fb9cd7ddb5ff047

Authored by Jarryd Beck
1 parent 2abdd4af

Fix crash with short only option

Showing 1 changed file with 4 additions and 4 deletions
include/cxxopts.hpp
... ... @@ -2628,8 +2628,8 @@ Options::help_one_group(const std::string& g) const
2628 2628  
2629 2629 for (const auto& o : group->second.options)
2630 2630 {
2631   - assert(!o.l.empty());
2632   - if (m_positional_set.find(o.l.front()) != m_positional_set.end() &&
  2631 + if (o.l.size() &&
  2632 + m_positional_set.find(o.l.front()) != m_positional_set.end() &&
2633 2633 !m_show_positional)
2634 2634 {
2635 2635 continue;
... ... @@ -2651,8 +2651,8 @@ Options::help_one_group(const std::string& g) const
2651 2651 auto fiter = format.begin();
2652 2652 for (const auto& o : group->second.options)
2653 2653 {
2654   - assert(!o.l.empty());
2655   - if (m_positional_set.find(o.l.front()) != m_positional_set.end() &&
  2654 + if (o.l.size() &&
  2655 + m_positional_set.find(o.l.front()) != m_positional_set.end() &&
2656 2656 !m_show_positional)
2657 2657 {
2658 2658 continue;
... ...