diff options
author | Adam <Adam@anope.org> | 2011-02-04 21:01:33 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-02-04 21:01:33 -0500 |
commit | 83556667fd7c9e780e2a67de68d3e2bda74a60ef (patch) | |
tree | 8ceed12d405da35841cbf376c47172bba3e9cb3f /modules/core/os_set.cpp | |
parent | faf5f3128f030f13cdd92ab5a46bfd116a083e87 (diff) |
try/catch-ified all instances of convertTo to keep from aborting when a user gives too large or too small a number
Diffstat (limited to 'modules/core/os_set.cpp')
-rw-r--r-- | modules/core/os_set.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp index 954ca636e..e606c0a1d 100644 --- a/modules/core/os_set.cpp +++ b/modules/core/os_set.cpp @@ -122,14 +122,19 @@ class CommandOSSet : public Command debug = 0; source.Reply(_("Services are now in non-debug mode.")); } - else if (setting.is_number_only() && convertTo<int>(setting) > 0) + else { - debug = convertTo<int>(setting); - Log(LOG_ADMIN, u, this) << "DEBUG " << debug; - source.Reply(_("Services are now in debug mode (level %d)."), debug); + try + { + debug = convertTo<int>(setting); + Log(LOG_ADMIN, u, this) << "DEBUG " << debug; + source.Reply(_("Services are now in debug mode (level %d)."), debug); + return MOD_CONT; + } + catch (const ConvertException &) { } + + source.Reply(_("Setting for DEBUG must be \002ON\002, \002OFF\002, or a positive number.")); } - else - source.Reply(_("Setting for DEBUG must be \002\002, \002\002, or a positive number.")); return MOD_CONT; } |