diff --git a/src/core/chat_room.cpp b/src/core/chat_room.cpp index 42c9829..936a8ad 100755 --- a/src/core/chat_room.cpp +++ b/src/core/chat_room.cpp @@ -116,8 +116,10 @@ namespace Yc auto newUser = std::make_shared(shared_from_this(), _userName, color, socket); _users.push_back(newUser); newUser->start(); - Json::Value roomList = _parent->jsonRoomList(); - newUser->sendMsg(ChatUser::roomList, roomList, "", ""); + if (_parent) { + Json::Value roomList = _parent->jsonRoomList(); + newUser->sendMsg(ChatUser::roomList, roomList, "", ""); + } // Sende aktuelle Userliste an den neuen User Json::Value currentUserList = userList(); diff --git a/src/core/ssl_server.cpp b/src/core/ssl_server.cpp index 28e656c..042a374 100644 --- a/src/core/ssl_server.cpp +++ b/src/core/ssl_server.cpp @@ -461,7 +461,7 @@ void SSLServer::createRooms() { for (const auto& room : roomList) { std::cout << "[YourChat] Config room: " << room << std::endl; // Create room objects using the same logic as the main server - auto newRoom = std::make_shared(nullptr, room); // parent will be set later + auto newRoom = std::make_shared(nullptr, room); _rooms.push_back(newRoom); } } else {