Fix crash exiting a server screen.

This commit is contained in:
hiker
2016-11-09 23:24:04 +11:00
parent 64d2d43f5b
commit 9201a08daf

View File

@@ -199,10 +199,11 @@ void NetworkingLobby::tearDown()
bool NetworkingLobby::onEscapePressed()
{
// notify the server that we left
ClientLobbyRoomProtocol* protocol = static_cast<ClientLobbyRoomProtocol*>(
ClientLobbyRoomProtocol* protocol = dynamic_cast<ClientLobbyRoomProtocol*>(
ProtocolManager::getInstance()->getProtocol(PROTOCOL_LOBBY_ROOM));
if (protocol)
protocol->leave();
STKHost::get()->shutdown();
return true; // close the screen
} // onEscapePressed