From da92286da9f3a3022d4641c29f6e5ecd9986f30b Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 21 Oct 2015 20:59:48 +0200 Subject: Fixed a crash when sending messages too early after connection. --- src/ClientHandle.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index bc7df883a..d3e30fc9c 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2097,7 +2097,18 @@ void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefi void cClientHandle::SendChat(const cCompositeChat & a_Message) { - m_Protocol->SendChat(a_Message, ctChatBox, GetPlayer()->GetWorld()->ShouldUseChatPrefixes()); + cWorld * World = GetPlayer()->GetWorld(); + if (World == nullptr) + { + World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName()); + if (World == nullptr) + { + World = cRoot::Get()->GetDefaultWorld(); + } + } + + bool ShouldUsePrefixes = World->ShouldUseChatPrefixes(); + m_Protocol->SendChat(a_Message, ctChatBox, ShouldUsePrefixes); } -- cgit v1.2.3