1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 10:16:40 +02:00

try/catch-ified all instances of convertTo to keep from aborting when a user gives too large or too small a number

This commit is contained in:
Adam
2011-02-04 21:01:33 -05:00
parent faf5f3128f
commit 83556667fd
12 changed files with 236 additions and 144 deletions
+12 -7
View File
@@ -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)
{
debug = convertTo<int>(setting);
Log(LOG_ADMIN, u, this) << "DEBUG " << debug;
source.Reply(_("Services are now in debug mode (level %d)."), debug);
}
else
source.Reply(_("Setting for DEBUG must be \002\002, \002\002, or a positive number."));
{
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."));
}
return MOD_CONT;
}