aboutsummaryrefslogtreecommitdiff
path: root/src/handler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/handler.cpp')
-rw-r--r--src/handler.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/handler.cpp b/src/handler.cpp
index 56aea76..5dea515 100644
--- a/src/handler.cpp
+++ b/src/handler.cpp
@@ -1,6 +1,7 @@
#include <winsock2.h>
#include "handler.h"
+#include "helper.h"
#include "plugin.h"
#include "internal/convarproxy.h"
@@ -106,18 +107,21 @@ void ServerHandler::run()
if (!request)
continue;
- std::string method_name = request->get_method();
-
- callback_list::const_iterator method_pos = this->methods.find(method_name);
- if (method_pos != this->methods.end())
- {
- spdlog::info("Invoked method '{}'", method_name);
- request->result(method_pos->second(request->get_allocator(), request->get_params()));
- }
- else
+ if (request->is_valid())
{
- spdlog::error("Attempted to invoke unknown method '{}'", method_name);
- request->error(rapidjson::Value("Unknown method"));
+ std::string method_name = request->get_method();
+
+ callback_list::const_iterator method_pos = this->methods.find(method_name);
+ if (method_pos != this->methods.end())
+ {
+ spdlog::info("Invoked method '{}'", method_name);
+ request->result(method_pos->second(request->get_allocator(), request->get_params()));
+ }
+ else
+ {
+ spdlog::error("Attempted to invoke unknown method '{}'", method_name);
+ request->error(rapidjson::Value("Unknown method"));
+ }
}
delete request;