Fix netid overflow check

This commit is contained in:
James R 2020-09-05 23:23:54 -07:00
parent 30057e9268
commit ca9cf25423

View file

@ -1262,12 +1262,12 @@ void CV_RegisterVar(consvar_t *variable)
// check net variables
if (variable->flags & CV_NETVAR)
{
variable->netid = ++consvar_number_of_netids;
/* in case of overflow... */
if (variable->netid > consvar_number_of_netids)
if (consvar_number_of_netids + 1 < consvar_number_of_netids)
I_Error("Way too many netvars");
variable->netid = ++consvar_number_of_netids;
#ifdef OLD22DEMOCOMPAT
CV_RegisterOldDemoVar(variable);
#endif