diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index 89bed4704..1ebaf7ab1 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -2188,7 +2188,9 @@ void p3ChatService::sendLobbyStatusItem(const ChatLobbyId& lobby_id,int type,con { RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/ - locked_initLobbyBouncableObject(lobby_id,item) ; + + if(! locked_initLobbyBouncableObject(lobby_id,item)) + return ; item.event_type = type ; item.string1 = status_string ; @@ -2198,7 +2200,7 @@ void p3ChatService::sendLobbyStatusItem(const ChatLobbyId& lobby_id,int type,con bounceLobbyObject(&item,ownId) ; } -void p3ChatService::locked_initLobbyBouncableObject(const ChatLobbyId& lobby_id,RsChatLobbyBouncingObject& item) +bool p3ChatService::locked_initLobbyBouncableObject(const ChatLobbyId& lobby_id,RsChatLobbyBouncingObject& item) { // get a pointer to the info for that chat lobby. // @@ -2209,7 +2211,7 @@ void p3ChatService::locked_initLobbyBouncableObject(const ChatLobbyId& lobby_id, #ifdef CHAT_DEBUG std::cerr << "Chatlobby for id " << std::hex << lobby_id << " has no record. This is a serious error!!" << std::dec << std::endl; #endif - return ; + return false; } ChatLobbyEntry& lobby(it->second) ; @@ -2223,6 +2225,8 @@ void p3ChatService::locked_initLobbyBouncableObject(const ChatLobbyId& lobby_id, item.lobby_id = lobby_id ; item.nick = lobby.nick_name ; + + return true ; } bool p3ChatService::sendLobbyChat(const std::string &id, const std::wstring& msg, const ChatLobbyId& lobby_id) @@ -2238,7 +2242,9 @@ bool p3ChatService::sendLobbyChat(const std::string &id, const std::wstring& msg { RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/ // gives a random msg id, setup the nickname - locked_initLobbyBouncableObject(lobby_id,item) ; + + if(! locked_initLobbyBouncableObject(lobby_id,item)) + return false; // chat msg stuff // diff --git a/libretroshare/src/services/p3chatservice.h b/libretroshare/src/services/p3chatservice.h index 9abb50b1a..f0dbe03f5 100644 --- a/libretroshare/src/services/p3chatservice.h +++ b/libretroshare/src/services/p3chatservice.h @@ -262,7 +262,7 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor, publi void sendLobbyStatusNewPeer(const ChatLobbyId& lobby_id) ; void sendLobbyStatusKeepAlive(const ChatLobbyId&) ; - void locked_initLobbyBouncableObject(const ChatLobbyId& id,RsChatLobbyBouncingObject&) ; + bool locked_initLobbyBouncableObject(const ChatLobbyId& id,RsChatLobbyBouncingObject&) ; static std::string makeVirtualPeerId(ChatLobbyId) ; static uint64_t makeConnexionChallengeCode(const std::string& peer_id,ChatLobbyId lobby_id,ChatLobbyMsgId msg_id) ;