From 9eab0cbaacaaef5f0852a6bf63f4458cdcc3070c Mon Sep 17 00:00:00 2001 From: newfrenchy83 Date: Fri, 27 Oct 2023 15:00:32 +0200 Subject: [PATCH] fix bool_matches_if_present don't verify if check boolean value or not. if filter[attribute] has value other what boolean, show an error massage. --- src/utils/config_filters.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/config_filters.cpp b/src/utils/config_filters.cpp index 5fc7d9e18cf1..b017d181b32c 100644 --- a/src/utils/config_filters.cpp +++ b/src/utils/config_filters.cpp @@ -15,6 +15,8 @@ #include #include +#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 @@ -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); }