Fix check_phone_number_rules.

GitOrigin-RevId: 9ecdc91dfc0b9f5f07af987a822cd607cbe690b1
This commit is contained in:
levlam 2018-05-24 19:40:00 +03:00
parent 3229ea3ce2
commit dd40469ee8
2 changed files with 5 additions and 1 deletions

View File

@ -367,6 +367,10 @@ class ConfigRecoverer : public Actor {
} }
static bool check_phone_number_rules(Slice phone_number, Slice rules) { static bool check_phone_number_rules(Slice phone_number, Slice rules) {
if (rules.empty() || phone_number.empty()) {
return true;
}
bool found = false; bool found = false;
for (auto prefix : full_split(rules, ',')) { for (auto prefix : full_split(rules, ',')) {
if (prefix.empty()) { if (prefix.empty()) {

View File

@ -43,7 +43,7 @@ TEST(Mtproto, config) {
auto run = [&](auto &func, bool is_test) { auto run = [&](auto &func, bool is_test) {
auto promise = PromiseCreator::lambda([&, num = cnt](Result<SimpleConfig> r_simple_config) { auto promise = PromiseCreator::lambda([&, num = cnt](Result<SimpleConfig> r_simple_config) {
if (r_simple_config.is_ok()) { if (r_simple_config.is_ok()) {
LOG(ERROR) << num << " " << to_string(r_simple_config.ok()); LOG(WARNING) << num << " " << to_string(r_simple_config.ok());
} else { } else {
LOG(ERROR) << num << " " << r_simple_config.error(); LOG(ERROR) << num << " " << r_simple_config.error();
} }