X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_randquote.cpp;h=668eea0e5cc0e8a2d1ae8fa83b247b3150c23b9a;hb=7dd831383f7506e49f568d0684ee1ecb1f5dc90f;hp=dab3c93cd3f0ada2cbd277dec34479133b91677c;hpb=349106f3f9f75d7f957fc5d1e71ca650f4807bb9;p=user%2Fhenk%2Fcode%2Finspircd.git 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& 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; }