Add bounds check for userid reset on disconnect#1108
Conversation
|
I wonder if we should scan the array instead in the failure case - we know it is in there somewhere and we don't really want to leave bad data behind, or is that fine? (I haven't fully parsed all the context of this yet, it's pretty late.) |
|
@asherkin we’d be doing a huge iteration which would raise some performance implications. Approximately 65k If userid is always increasing, I presume it’s fine to just leave bad data in, but that allows for the possibility of getclientuserid to return an invalid client index that’s not -1 honestly probably needs a hashset |
asherkin
left a comment
There was a problem hiding this comment.
Whoops - yeah, I initially parsed this as being the other way.
It looks like GetClientOfUserId already expects this cache to be garbage sometimes, so
. (Although it might be worth updating / removing the comment about older engines there.)
Fixes #1107
Left out the check for player connection since it may be impossible for IVEngineServer::GetPlayerUserId to return -1 at the point in time we ask for it.