Fix crash in command handling
This commit is contained in:
parent
9ca63fd88a
commit
bb6f11c523
@ -27,12 +27,19 @@ namespace network
|
||||
const auto cmd_string = utils::string::to_lower(command);
|
||||
auto& callbacks = get_callbacks();
|
||||
const auto handler = callbacks.find(cmd_string);
|
||||
|
||||
if (handler == callbacks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto offset = cmd_string.size() + 5;
|
||||
|
||||
if (message->cursize <= offset)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string_view data(message->data + offset, message->cursize - offset);
|
||||
|
||||
handler->second(*address, data);
|
||||
|
Loading…
Reference in New Issue
Block a user