From 7c96c7fbf5059c87fed62f3dee7a3df8aa3902b6 Mon Sep 17 00:00:00 2001 From: timulations <108556839+timulations@users.noreply.github.com> Date: Tue, 18 Apr 2023 01:08:17 +1000 Subject: [PATCH] Fix bug on Mac M1 with redis chat example code (#1566) --- examples/redis_chat/controllers/Chat.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/redis_chat/controllers/Chat.cc b/examples/redis_chat/controllers/Chat.cc index 48fd7554..60343c48 100644 --- a/examples/redis_chat/controllers/Chat.cc +++ b/examples/redis_chat/controllers/Chat.cc @@ -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].");