summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-05-16 19:57:53 -0400
committerAdam <Adam@anope.org>2013-05-16 19:57:53 -0400
commit3f782d5cad84165d695203977c75d2a3877f4644 (patch)
tree61943af44d45733afe159ba39ad8769a8293face /src/modules
parentbb962f92ace6eb23c66c5fccee01f825c22363c3 (diff)
Fix m_randquote with 0 quotes
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_randquote.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index dab3c93cd..668eea0e5 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -41,12 +41,13 @@ class CommandRandquote : public Command
CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- std::string str;
- int fsize;
-
- fsize = quotes->FileSize();
- str = quotes->GetLine(ServerInstance->GenRandomInt(fsize));
- user->WriteServ("NOTICE %s :%s%s%s",user->nick.c_str(),prefix.c_str(),str.c_str(),suffix.c_str());
+ int fsize = quotes->FileSize();
+ if (fsize)
+ {
+ std::string str = quotes->GetLine(ServerInstance->GenRandomInt(fsize));
+ if (!str.empty())
+ user->WriteServ("NOTICE %s :%s%s%s",user->nick.c_str(),prefix.c_str(),str.c_str(),suffix.c_str());
+ }
return CMD_SUCCESS;
}