From 66de1ceee109d04fe2c51bd53584594df04e9d69 Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 2 May 2020 12:01:47 -0400 Subject: [PATCH] Netplay: Fixed crashes when disconnect from server or stopping server while no game is loaded --- Core/GameClientConnection.cpp | 5 ++++- Core/GameServer.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Core/GameClientConnection.cpp b/Core/GameClientConnection.cpp index 6a7a5a0e..7db73e76 100644 --- a/Core/GameClientConnection.cpp +++ b/Core/GameClientConnection.cpp @@ -40,7 +40,10 @@ void GameClientConnection::Shutdown() _shutdown = true; DisableControllers(); - _console->GetControlManager()->UnregisterInputProvider(this); + ControlManager* controlManager = _console->GetControlManager(); + if(controlManager) { + controlManager->UnregisterInputProvider(this); + } _console->GetNotificationManager()->SendNotification(ConsoleNotificationType::DisconnectedFromServer); MessageManager::DisplayMessage("NetPlay", "ConnectionLost"); _console->GetSettings()->ClearFlags(EmulationFlags::ForceMaxSpeed); diff --git a/Core/GameServer.cpp b/Core/GameServer.cpp index f4a03c38..66948144 100644 --- a/Core/GameServer.cpp +++ b/Core/GameServer.cpp @@ -32,8 +32,11 @@ GameServer::~GameServer() Stop(); - _console->GetControlManager()->UnregisterInputRecorder(this); - _console->GetControlManager()->UnregisterInputProvider(this); + ControlManager* controlManager = _console->GetControlManager(); + if(controlManager) { + controlManager->UnregisterInputRecorder(this); + controlManager->UnregisterInputProvider(this); + } } void GameServer::RegisterServerInput()