Fix bug on Mac M1 with redis chat example code (#1566)

This commit is contained in:
timulations 2023-04-18 01:08:17 +10:00 committed by GitHub
parent 65b1715539
commit 7c96c7fbf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ void Chat::handleNewMessage(const WebSocketConnectionPtr& wsConnPtr,
std::string room;
if (message.compare(0, 6, "ENTER ") == 0)
{
room = message.substr(6);
room = message.substr(6, message.find_last_not_of(" \n") - 5);
if (!checkRoomNumber(room))
{
wsConnPtr->send("ERROR: Invalid room number, should be [0-99].");