diff --git a/src/func.cpp b/src/func.cpp index d857dc4c..4c46d98a 100644 --- a/src/func.cpp +++ b/src/func.cpp @@ -22,10 +22,13 @@ int Func::Base::Action::from_string(const std::string_view policyname_) { - policy = Policies::Action::find(policyname_); - if(!policy) + auto *tmp = Policies::Action::find(policyname_); + + if(not tmp) return -EINVAL; + policy = tmp; + return 0; } @@ -38,10 +41,13 @@ Func::Base::Action::to_string(void) const int Func::Base::Create::from_string(const std::string_view policyname_) { - policy = Policies::Create::find(policyname_); - if(!policy) + auto *tmp = Policies::Create::find(policyname_); + + if(not tmp) return -EINVAL; + policy = tmp; + return 0; } @@ -54,10 +60,13 @@ Func::Base::Create::to_string(void) const int Func::Base::Search::from_string(const std::string_view policyname_) { - policy = Policies::Search::find(policyname_); - if(!policy) + auto *tmp = Policies::Search::find(policyname_); + + if(not tmp) return -EINVAL; + policy = tmp; + return 0; }