summaryrefslogtreecommitdiff
path: root/modules/core/os_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/os_session.cpp')
-rw-r--r--modules/core/os_session.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp
index dd10c2cae..835607f45 100644
--- a/modules/core/os_session.cpp
+++ b/modules/core/os_session.cpp
@@ -125,7 +125,12 @@ class CommandOSSession : public Command
{
Anope::string param = params[1];
- unsigned mincount = param.is_pos_number_only() ? convertTo<unsigned>(param) : 0;
+ unsigned mincount = 0;
+ try
+ {
+ mincount = convertTo<unsigned>(param);
+ }
+ catch (const ConvertException &) { }
if (mincount <= 1)
source.Reply(_("Invalid threshold value. It must be a valid integer greater than 1."));
@@ -260,7 +265,12 @@ class CommandOSException : public Command
else if (expires > 0)
expires += Anope::CurTime;
- int limit = !limitstr.empty() && limitstr.is_number_only() ? convertTo<int>(limitstr) : -1;
+ int limit = -1;
+ try
+ {
+ limit = convertTo<int>(limitstr);
+ }
+ catch (const ConvertException &) { }
if (limit < 0 || limit > static_cast<int>(Config->MaxSessionLimit))
{
@@ -334,8 +344,13 @@ class CommandOSException : public Command
return MOD_CONT;
}
- n1 = n1str.is_pos_number_only() ? convertTo<int>(n1str) - 1 : -1;
- n2 = n2str.is_pos_number_only() ? convertTo<int>(n2str) - 1 : -1;
+ n1 = n2 = -1;
+ try
+ {
+ n1 = convertTo<int>(n1str);
+ n2 = convertTo<int>(n2str);
+ }
+ catch (const ConvertException &) { }
if (n1 >= 0 && n1 < exceptions.size() && n2 >= 0 && n2 < exceptions.size() && n1 != n2)
{