port: net: don't crash if there aren't any player props

although I still don't know what actually leads to this situation
This commit is contained in:
fgsfds committed 2024-01-14 15:38:05 +01:00
1 parent 31d8aae704
commit a46ce32ad4
1 file changed
+5
+5
View File
@@ -934,6 +934,11 @@ void netSyncIdsAllocate(void)
// HACK: when we're a client, we'll need to swap our player and server player's props
// because of what we do in netPlayersAllocate
if (g_NetMode == NETMODE_CLIENT) {
if (!g_Vars.players[g_NetLocalClient->id]->prop || !g_Vars.players[0]->prop) {
sysLogPrintf(LOG_ERROR, "NET: no props allocated for players?");
netDisconnect();
return;
}
const u16 sid = g_Vars.players[g_NetLocalClient->id]->prop->syncid;
g_Vars.players[g_NetLocalClient->id]->prop->syncid = g_Vars.players[0]->prop->syncid;
g_Vars.players[0]->prop->syncid = sid;