Netplay: be sure to first check whether the peer is is not a nullptr.
This commit is contained in:
parent
9b81f6a5d4
commit
d1519e141a
|
@ -1267,8 +1267,8 @@ void Netplay::UpdateResetState()
|
||||||
{
|
{
|
||||||
if (!IsValidPlayerId(i) || s_reset_players.test(i))
|
if (!IsValidPlayerId(i) || s_reset_players.test(i))
|
||||||
continue;
|
continue;
|
||||||
|
// be sure to first check whether the peer is still valid.
|
||||||
if (s_peers[i].peer->state == ENET_PEER_STATE_CONNECTED)
|
if (s_peers[i].peer && s_peers[i].peer->state == ENET_PEER_STATE_CONNECTED)
|
||||||
s_reset_players.set(i);
|
s_reset_players.set(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,10 +1645,6 @@ void Netplay::SetInputs(Netplay::Input inputs[2])
|
||||||
void Netplay::TestNetplaySession(s32 local_handle, u16 local_port, const std::string& remote_addr, u16 remote_port,
|
void Netplay::TestNetplaySession(s32 local_handle, u16 local_port, const std::string& remote_addr, u16 remote_port,
|
||||||
s32 input_delay, std::string game_path)
|
s32 input_delay, std::string game_path)
|
||||||
{
|
{
|
||||||
// dont want to start a session when theres already one going on.
|
|
||||||
if (IsActive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const bool is_hosting = (local_handle == 1);
|
const bool is_hosting = (local_handle == 1);
|
||||||
if (!CreateSystem(std::move(game_path), is_hosting))
|
if (!CreateSystem(std::move(game_path), is_hosting))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue