From 5a3ac07e14603a3900ed083e3bfe4b4075c6ecfb Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 27 Feb 2014 17:10:41 +0100 Subject: cmd_topic Remove redundant NULL check --- src/commands/cmd_topic.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/commands') diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index 38982a7a2..25daea142 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -64,23 +64,20 @@ CmdResult CommandTopic::HandleLocal(const std::vector& parameters, if (parameters.size() == 1) { - if (c) + if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) { - if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) - { - user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str()); - return CMD_FAILURE; - } + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str()); + return CMD_FAILURE; + } - if (c->topic.length()) - { - user->WriteNumeric(RPL_TOPIC, "%s :%s", c->name.c_str(), c->topic.c_str()); - user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); - } - else - { - user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str()); - } + if (c->topic.length()) + { + user->WriteNumeric(RPL_TOPIC, "%s :%s", c->name.c_str(), c->topic.c_str()); + user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); + } + else + { + user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str()); } return CMD_SUCCESS; } -- cgit v1.2.3