FIX: OptionsGroup::get_line with multiple options

Change-Id: I9c96b0e5de5674e558aeb66d306da3519750fa65
Jira: STUDIO-10887
(cherry picked from commit f0656ee986189d5ca34a088c3e584c4f973e1538)
This commit is contained in:
chunmao.guo 2025-03-17 10:48:20 +08:00 committed by Noisyfox
parent 5105f1d28b
commit 7e15661a42

View file

@ -244,12 +244,11 @@ void OptionsGroup::append_line(const Line& line)
//BBS: get line for opt_key
Line* OptionsGroup::get_line(const std::string& opt_key)
{
for (auto& l : m_lines)
for (int index = 0; index < m_lines.size(); index++)
{
if(l.is_separator())
continue;
if (l.get_first_option_key() == opt_key)
return &l;
for (auto & opt : m_lines[index].get_options())
if (opt.opt_id == opt_key)
return &(m_lines[index]);
}
return nullptr;