1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 06:36:39 +02:00

Bug #1222 - Fixed crash from reading to read a range of memos

This commit is contained in:
Adam
2010-12-27 01:00:12 -05:00
parent 0c686e7168
commit 87141253a1
+6 -6
View File
@@ -49,7 +49,7 @@ class MemoListCallback : public NumberList
class CommandMSRead : public Command
{
public:
CommandMSRead() : Command("READ", 0, 2)
CommandMSRead() : Command("READ", 1, 2)
{
}
@@ -57,8 +57,7 @@ class CommandMSRead : public Command
{
MemoInfo *mi;
ChannelInfo *ci = NULL;
Anope::string numstr = !params.empty() ? params[0] : "", chan;
int num;
Anope::string numstr = params[0], chan;
if (!numstr.empty() && numstr[0] == '#')
{
@@ -79,8 +78,8 @@ class CommandMSRead : public Command
}
else
mi = &u->Account()->memos;
num = !numstr.empty() && numstr.is_number_only() ? convertTo<int>(numstr) : -1;
if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && num <= 0))
if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && !numstr.is_number_only()))
this->OnSyntaxError(u, numstr);
else if (mi->memos.empty())
{
@@ -89,7 +88,8 @@ class CommandMSRead : public Command
else
u->SendMessage(MemoServ, MEMO_HAVE_NO_MEMOS);
}
else {
else
{
int i, end;
if (numstr.equals_ci("NEW"))