[qw] Check tracked player name before printing

The server switching levels while the client is tracking a player (at
least a server client) seems to at least temporarily clear the player
slot and thus the name value pointer becomes null. This fixes the
resulting segfault.
This commit is contained in:
Bill Currie 2021-12-30 02:02:22 +09:00
parent 70aaafda10
commit 7a481039f8

View file

@ -829,8 +829,12 @@ draw_spectator (view_t *view)
"Press [ATTACK] for AutoCamera");
} else {
// Sbar_DrawString (160-14*8+4,4, "SPECTATOR MODE - TRACK CAMERA");
snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next",
cl.players[spec_track].name->value);
if (cl.players[spec_track].name) {
snprintf (st, sizeof (st), "Tracking %-.13s, [JUMP] for next",
cl.players[spec_track].name->value);
} else {
snprintf (st, sizeof (st), "Lost player, [JUMP] for next");
}
draw_string (view, 0, -8, st);
}
}