Skip to content

Commit

Permalink
fix bool_matches_if_present don't verify if check boolean value or not.
Browse files Browse the repository at this point in the history
if filter[attribute] has value other what boolean, show an error massage.
  • Loading branch information
newfrenchy83 committed Oct 27, 2023
1 parent 81bbcab commit 9eab0cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/config_filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <algorithm>
#include <vector>

#include "gettext.hpp"
#include "gui/dialogs/message.hpp" // for show_error_message
#include "utils/config_filters.hpp"

#include "serialization/string_utils.hpp" // for utils::split
Expand All @@ -25,6 +27,10 @@ bool utils::config_filters::bool_matches_if_present(const config& filter, const
if(!filter.has_attribute(attribute)) {
return true;
}
//check if filter is boolean, if not then show error message.
if(filter[attribute].to_bool(true) != filter[attribute].to_bool(false)) {
gui2::show_error_message(_("The filter ") + attribute + _(" can only take the values yes/true or no/false."));
}

return filter[attribute].to_bool() == cfg[attribute].to_bool(def);
}
Expand Down

0 comments on commit 9eab0cb

Please sign in to comment.