Properly set the default values for invalid integer conf options
fix #3372
This commit is contained in:
@@ -192,7 +192,13 @@ void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session,
|
|||||||
|
|
||||||
if (field->get_tag("var") == "max_history_length" &&
|
if (field->get_tag("var") == "max_history_length" &&
|
||||||
value && !value->get_inner().empty())
|
value && !value->get_inner().empty())
|
||||||
options.col<Database::MaxHistoryLength>() = atoi(value->get_inner().data());
|
{
|
||||||
|
try {
|
||||||
|
options.col<Database::MaxHistoryLength>() = std::stol(value->get_inner().data());
|
||||||
|
} catch (const std::logic_error&) {
|
||||||
|
options.col<Database::MaxHistoryLength>() = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (field->get_tag("var") == "record_history" &&
|
else if (field->get_tag("var") == "record_history" &&
|
||||||
value && !value->get_inner().empty())
|
value && !value->get_inner().empty())
|
||||||
{
|
{
|
||||||
@@ -497,7 +503,7 @@ void ConfigureIrcServerStep2(XmppComponent& xmpp_component, AdhocSession& sessio
|
|||||||
try {
|
try {
|
||||||
options.col<Database::ThrottleLimit>() = std::stol(value->get_inner());
|
options.col<Database::ThrottleLimit>() = std::stol(value->get_inner());
|
||||||
} catch (const std::logic_error&) {
|
} catch (const std::logic_error&) {
|
||||||
options.col<Database::ThrottleLimit>() = -1;
|
options.col<Database::ThrottleLimit>() = 10;
|
||||||
}
|
}
|
||||||
Bridge* bridge = biboumi_component.find_user_bridge(session.get_owner_jid());
|
Bridge* bridge = biboumi_component.find_user_bridge(session.get_owner_jid());
|
||||||
if (bridge)
|
if (bridge)
|
||||||
|
|||||||
Reference in New Issue
Block a user