1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 11:06:38 +02:00

Deduplicate RPC parameter count checks.

This commit is contained in:
Sadie Powell
2025-02-25 23:13:54 +00:00
parent bb3e124bdb
commit 752f5e269e
4 changed files with 29 additions and 30 deletions
+10 -1
View File
@@ -150,7 +150,16 @@ public:
return true;
}
if (!event->second->Run(this, client, request))
auto *eh = event->second;
if (request.data.size() < eh->GetMinParams())
{
auto error = Anope::printf("Not enough parameters (given %zu, expected %zu)",
request.data.size(), eh->GetMinParams());
SendError(reply, RPC::ERR_INVALID_PARAMS, error, id);
return true;
}
if (!eh->Run(this, client, request))
return false;
this->Reply(request);