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:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user