Skip to content

Commit

Permalink
Don't add duplicate options to the page
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Jan 30, 2020
1 parent 61cd828 commit 8683354
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ void options_manager::addOptionToPage( const std::string &name, const std::strin
{
for( Page &p : pages_ ) {
if( p.id_ == page ) {
// Don't add duplicate options to the page
for( const cata::optional<std::string> &i : p.items_ ) {
if( i.has_value() && i.value() == name ) {
return;
}
}
p.items_.emplace_back( name );
return;
}
}
// @TODO handle the case when an option has no valid page id (note: consider hidden external options as well)
Expand Down

0 comments on commit 8683354

Please sign in to comment.