diff options
33 files changed, 66 insertions, 34 deletions
diff --git a/include/services.h b/include/services.h index 8e1adcf01..fdbaccbfc 100644 --- a/include/services.h +++ b/include/services.h @@ -39,7 +39,6 @@ #include <sys/stat.h> /* for umask() on some systems */ #include <sys/types.h> -#include <assert.h> #include <fcntl.h> #include <typeinfo> diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index dd485bb40..a89f30c36 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -23,7 +23,8 @@ class CommandCSSASetNoexpire : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSASetNoexpire"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 3c7e1c11a..90041c7e6 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -23,7 +23,8 @@ class CommandCSSetBanType : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetBanType"); Anope::string end; diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index 82260df63..9186b55ab 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -23,7 +23,8 @@ class CommandCSSetDescription : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetDescription"); ci->desc = params[1]; diff --git a/modules/core/cs_set_entrymsg.cpp b/modules/core/cs_set_entrymsg.cpp index 9784773e4..362a5eea3 100644 --- a/modules/core/cs_set_entrymsg.cpp +++ b/modules/core/cs_set_entrymsg.cpp @@ -23,7 +23,8 @@ class CommandCSSetEntryMsg : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetEntryMsg"); if (params.size() > 1) { diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index 3982764cc..4fb83a9ec 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -23,7 +23,8 @@ class CommandCSSetFounder : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetFounder"); if (this->permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER))) { diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index 5eb907dbd..28a6cd550 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -23,7 +23,8 @@ class CommandCSSetKeepTopic : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetKeepTopic"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_mlock.cpp b/modules/core/cs_set_mlock.cpp index 166f6f71c..ec41913b9 100644 --- a/modules/core/cs_set_mlock.cpp +++ b/modules/core/cs_set_mlock.cpp @@ -23,7 +23,8 @@ class CommandCSSetMLock : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetMLock"); int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */ ChannelMode *cm; diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index a0d0a2ec8..2b835451c 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -23,7 +23,8 @@ class CommandCSSetOpNotice : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetOpNotice"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index b00bf26d5..aa058b416 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -23,7 +23,8 @@ class CommandCSSetPeace : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetPeace"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index b2876d476..2ab310f2a 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -23,7 +23,8 @@ class CommandCSSetPersist : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetPersist"); ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM); diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index 8ade236c8..7d1cd0d82 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -23,7 +23,8 @@ class CommandCSSetPrivate : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetPrivate"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index 82520bbcc..e51024baa 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -22,7 +22,8 @@ class CommandCSSetRestricted : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetRestricted"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp index 817608987..98babf1d7 100644 --- a/modules/core/cs_set_secure.cpp +++ b/modules/core/cs_set_secure.cpp @@ -23,7 +23,8 @@ class CommandCSSetSecure : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetSecure"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp index 7c2e310d9..d6ef6aef8 100644 --- a/modules/core/cs_set_securefounder.cpp +++ b/modules/core/cs_set_securefounder.cpp @@ -23,7 +23,8 @@ class CommandCSSetSecureFounder : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetSecureFounder"); if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER)) { diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp index 6d705dd6a..c9367dae7 100644 --- a/modules/core/cs_set_secureops.cpp +++ b/modules/core/cs_set_secureops.cpp @@ -23,7 +23,8 @@ class CommandCSSetSecureOps : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetSecureIos"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp index 93e5c287a..d62a5eec4 100644 --- a/modules/core/cs_set_signkick.cpp +++ b/modules/core/cs_set_signkick.cpp @@ -23,7 +23,8 @@ class CommandCSSetSignKick : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetSignKick"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp index 4ba445300..c0c913487 100644 --- a/modules/core/cs_set_successor.cpp +++ b/modules/core/cs_set_successor.cpp @@ -23,7 +23,8 @@ class CommandCSSetSuccessor : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetSuccessor"); if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER)) { diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp index 26f053b69..b60a687b4 100644 --- a/modules/core/cs_set_topiclock.cpp +++ b/modules/core/cs_set_topiclock.cpp @@ -23,7 +23,8 @@ class CommandCSSetTopicLock : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetTopicLock"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp index 37247f394..c7d4017b0 100644 --- a/modules/core/cs_set_xop.cpp +++ b/modules/core/cs_set_xop.cpp @@ -30,7 +30,8 @@ class CommandCSSetXOP : public Command } ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetXOP"); if (params[1].equals_ci("ON")) { diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index 4beccbcad..081e1d466 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -128,7 +128,8 @@ class CommandNSSASetDisplay : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetDisplay"); NickAlias *na = findnick(params[1]); if (!na || na->nc != nc) @@ -170,7 +171,8 @@ class CommandNSSASetPassword : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetPassword"); size_t len = params[1].length(); diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp index 2c8f93243..62b93d7e9 100644 --- a/modules/core/ns_saset_noexpire.cpp +++ b/modules/core/ns_saset_noexpire.cpp @@ -23,7 +23,8 @@ class CommandNSSASetNoexpire : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickAlias *na = findnick(params[0]); - assert(na); + if (!na) + throw CoreException("NULL na in CommandNSSASsetNoexpire"); Anope::string param = params.size() > 1 ? params[1] : ""; diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp index 2c8c8b1c4..da8b8ccb9 100644 --- a/modules/core/ns_set_autoop.cpp +++ b/modules/core/ns_set_autoop.cpp @@ -65,7 +65,8 @@ class CommandNSSASetAutoOp : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetAutoOp"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp index bf3162611..070e93026 100644 --- a/modules/core/ns_set_email.cpp +++ b/modules/core/ns_set_email.cpp @@ -71,7 +71,8 @@ class CommandNSSASetEmail : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetEmail"); Anope::string param = params.size() > 1 ? params[1] : ""; diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp index 128257924..4704bf1ca 100644 --- a/modules/core/ns_set_greet.cpp +++ b/modules/core/ns_set_greet.cpp @@ -58,7 +58,8 @@ class CommandNSSASetGreet : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetGreet"); Anope::string param = params.size() > 1 ? params[1] : ""; diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp index 5eaa1f39c..8432794ff 100644 --- a/modules/core/ns_set_hide.cpp +++ b/modules/core/ns_set_hide.cpp @@ -98,7 +98,8 @@ class CommandNSSASetHide : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetHide"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp index f7312710f..cad473543 100644 --- a/modules/core/ns_set_kill.cpp +++ b/modules/core/ns_set_kill.cpp @@ -88,7 +88,8 @@ class CommandNSSASetKill : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetKill"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp index 06f29ae48..c76bf0fef 100644 --- a/modules/core/ns_set_language.cpp +++ b/modules/core/ns_set_language.cpp @@ -70,7 +70,8 @@ class CommandNSSASetLanguage : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetLanguage"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp index 25ad660d7..f31d4aebe 100644 --- a/modules/core/ns_set_message.cpp +++ b/modules/core/ns_set_message.cpp @@ -71,7 +71,8 @@ class CommandNSSASetMessage : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetMessage"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp index 5e8aff432..c3ce5c8eb 100644 --- a/modules/core/ns_set_private.cpp +++ b/modules/core/ns_set_private.cpp @@ -65,7 +65,8 @@ class CommandNSSASetPrivate : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetPrivate"); Anope::string param = params[1]; diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp index 66990f423..872829924 100644 --- a/modules/core/ns_set_secure.cpp +++ b/modules/core/ns_set_secure.cpp @@ -65,7 +65,8 @@ class CommandNSSASetSecure : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSASetSecure"); Anope::string param = params[1]; diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index 7cffe6866..d287a24c1 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -23,7 +23,8 @@ class CommandCSSetMisc : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { ChannelInfo *ci = cs_findchan(params[0]); - assert(ci); + if (!ci) + throw CoreException("NULL ci in CommandCSSetMisc"); ci->Shrink("chanserv:" + this->name); if (params.size() > 1) diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index 9e0f23eb0..8ab54fd05 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -22,7 +22,8 @@ class CommandNSSetMisc : public Command CommandReturn RealExecute(User *u, const std::vector<Anope::string> ¶ms) { NickCore *nc = findcore(params[0]); - assert(nc); + if (!nc) + throw CoreException("NULL nc in CommandNSSetMisc"); nc->Shrink("nickserv:" + this->name); if (params.size() > 1) |