1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 03:13:13 +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
+13 -8
View File
@@ -226,16 +226,21 @@ class NewsBase : public Command
}
if (!text.equals_ci("ALL"))
{
num = text.is_pos_number_only() ? convertTo<unsigned>(text) : 0;
if (num > 0 && del_newsitem(num, type))
try
{
source.Reply(msgs[MSG_DELETED], num);
for (unsigned i = 0, end = News.size(); i < end; ++i)
if (News[i]->type == type && News[i]->num > num)
--News[i]->num;
unsigned num = convertTo<unsigned>(text);
if (num > 0 && del_newsitem(num, type))
{
source.Reply(msgs[MSG_DELETED], num);
for (unsigned i = 0, end = News.size(); i < end; ++i)
if (News[i]->type == type && News[i]->num > num)
--News[i]->num;
return MOD_CONT;
}
}
else
source.Reply(msgs[MSG_DEL_NOT_FOUND], num);
catch (const ConvertException &) { }
source.Reply(msgs[MSG_DEL_NOT_FOUND], num);
}
else
{