summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-12-27 01:00:12 -0500
committerAdam <Adam@anope.org>2010-12-27 01:03:13 -0500
commit87141253a1d0777486ff07d5f08c1b4bc05dbd32 (patch)
tree9ca3192a7e25ae76c7a140c5d458ae97b4e2b8e6
parent0c686e7168cfbdd74ec9d2b4df20f0bc224f677e (diff)
Bug #1222 - Fixed crash from reading to read a range of memos
-rw-r--r--modules/core/ms_read.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp
index 2f743cb30..e0c87192e 100644
--- a/modules/core/ms_read.cpp
+++ b/modules/core/ms_read.cpp
@@ -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"))