Permalink
Browse files

Fix compile warning in webcpanel/memos

  • Loading branch information...
1 parent 75999e0 commit 367b662c8344c6cd2f7f3da0760de0f032b54171 @Adam- Adam- committed Mar 3, 2013
Showing with 10 additions and 13 deletions.
  1. +10 −13 modules/extra/webcpanel/pages/memoserv/memos.cpp
@@ -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)
{
std::vector<Anope::string> params;
- int number;
- bool error = false;
+ int number = -1;
try
{
@@ -81,21 +80,19 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
catch (const ConvertException &ex)
{
replacements["MESSAGES"] = "ERROR - invalid parameter for NUMBER";
- error = true;
}
- m = mi->GetMemo(number-1);
-
- if (!error && !m)
+ if (number > 0)
{
- replacements["MESSAGES"] = "ERROR - invalid memo number.";
- error = true;
+ m = mi->GetMemo(number-1);
+
+ 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)

0 comments on commit 367b662

Please sign in to comment.