From 88db848d207a71704d8247f9938f8649835e5e30 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Mon, 7 May 2018 21:57:37 +0200 Subject: [PATCH] fix uncaught stoi exception (cherry-picked from commit e88a73fc2a5b4deb4c67650b419d0ef528088a65) --- src/units/filter.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/units/filter.cpp b/src/units/filter.cpp index 6d19cccf4531..71c390652069 100644 --- a/src/units/filter.cpp +++ b/src/units/filter.cpp @@ -39,6 +39,7 @@ static lg::log_domain log_config("config"); #define ERR_CF LOG_STREAM(err, log_config) +#define WRN_CF LOG_STREAM(warn, log_config) #define DBG_CF LOG_STREAM(debug, log_config) using namespace unit_filter_impl; @@ -440,7 +441,11 @@ void unit_filter_compound::fill(vconfig cfg) { std::vector res; for(const std::string& s : utils::split(c.str())) { - res.push_back(std::stoi(s)); + try { + res.push_back(std::stoi(s)); + } catch(std::invalid_argument&) { + WRN_CF << "ignored invalid side='" << s << "' in filter\n"; + } } return res; },