Less branches

This commit is contained in:
alesapin 2019-08-01 20:46:37 +03:00
parent 7c37450c3d
commit ca3796f0a3

View File

@ -74,8 +74,6 @@ void SettingNumber<bool>::set(const String & x)
set(false);
else if (x[0] == '1')
set(true);
else
throw Exception("Cannot parse bool from string '" + x + "'", ErrorCodes::CANNOT_PARSE_BOOL);
}
else
{
@ -84,9 +82,9 @@ void SettingNumber<bool>::set(const String & x)
set(true);
else if (checkStringCaseInsensitive("false", buf))
set(false);
else
throw Exception("Cannot parse bool from string '" + x + "'", ErrorCodes::CANNOT_PARSE_BOOL);
}
if (!changed)
throw Exception("Cannot parse bool from string '" + x + "'", ErrorCodes::CANNOT_PARSE_BOOL);
}
template <typename Type>