Fix the servers crashing when suddenly exiting voting (ie everyone leaves)

This commit is contained in:
NepDisk 2025-12-12 13:50:21 -05:00
parent 2e4aea934d
commit c8d54b4546
2 changed files with 9 additions and 2 deletions

View file

@ -3216,10 +3216,9 @@ void D_PickVote(void)
}
}
key = M_RandomKey(numvotes);
if (numvotes > 0)
{
key = M_RandomKey(numvotes);
WRITESINT8(p, temppicks[key]);
WRITESINT8(p, templevels[key]);
}

View file

@ -2011,6 +2011,14 @@ void Y_StartVote(void)
//
void Y_EndVote(void)
{
if (nextmap >= NEXTMAP_SPECIAL)
{
// Don't leave nextmap unset if the vote is ended through
// weird means! (such as a dedicated server becoming empty)
// If nextmap was left at NEXTMAP_VOTING, we'd crash!
Y_VoteStops(0, 0);
}
Y_UnloadVoteData();
voteendtic = -1;
}