]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_randquote.cpp
Merge pull request #1157 from SaberUK/insp20+fix-cron-restart
[user/henk/code/inspircd.git] / src / modules / m_randquote.cpp
index dab3c93cd3f0ada2cbd277dec34479133b91677c..668eea0e5cc0e8a2d1ae8fa83b247b3150c23b9a 100644 (file)
@@ -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;
        }