Skip to content

Commit

Permalink
Fix compile warning in webcpanel/memos
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Mar 3, 2013
1 parent 75999e0 commit 367b662
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions modules/extra/webcpanel/pages/memoserv/memos.cpp
Expand Up @@ -71,8 +71,7 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
if (message.get_data.count("read") > 0 && message.get_data.count("number") > 0) if (message.get_data.count("read") > 0 && message.get_data.count("number") > 0)
{ {
std::vector<Anope::string> params; std::vector<Anope::string> params;
int number; int number = -1;
bool error = false;


try try
{ {
Expand All @@ -81,21 +80,19 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
catch (const ConvertException &ex) catch (const ConvertException &ex)
{ {
replacements["MESSAGES"] = "ERROR - invalid parameter for NUMBER"; replacements["MESSAGES"] = "ERROR - invalid parameter for NUMBER";
error = true;
} }


m = mi->GetMemo(number-1); if (number > 0)

if (!error && !m)
{ {
replacements["MESSAGES"] = "ERROR - invalid memo number."; m = mi->GetMemo(number-1);
error = true;
if (!m)
replacements["MESSAGES"] = "ERROR - invalid memo number.";
else if (message.get_data["read"] == "1")
m->unread = false;
else if (message.get_data["read"] == "2")
m->unread = true;
} }

if (!error && message.get_data["read"] == "1")
m->unread = false;
else if (!error && message.get_data["read"] == "2")
m->unread = true;
} }


for (unsigned i = 0; i < mi->memos->size(); ++i) for (unsigned i = 0; i < mi->memos->size(); ++i)
Expand Down

0 comments on commit 367b662

Please sign in to comment.