wiremod / advdupe2

Advanced Duplicator 2
http://wiremod.com
Apache License 2.0
89 stars 60 forks source link

SV error: attempt to index field 'HeadEnt' #431

Open wrefgtzweve opened 1 year ago

wrefgtzweve commented 1 year ago

I've had this sv error happen a few times over the last few days from different players, not sure how to exactly trigger it but i assume it's somehow getting through the dupe sanitization.

addons/advdupe2/lua/weapons/gmod_tool/stools/advdupe2.lua:192: attempt to index field 'HeadEnt' (a nil value)
   1.  __index - [C]:-1
    2.  GetDupeElevation - addons/advdupe2/lua/weapons/gmod_tool/stools/advdupe2.lua:192
     3.  LeftClick - addons/advdupe2/lua/weapons/gmod_tool/stools/advdupe2.lua:215
      4.  <unknown> - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:226
thegrb93 commented 1 year ago

Might be the player's dupe table getting cleared and that code still being executed somehow. The sanitization checks for HeadEnt.

thegrb93 commented 1 year ago

Could probably just add or not ply.AdvDupe2.HeadEnt to https://github.com/wiremod/advdupe2/blob/master/lua/weapons/gmod_tool/stools/advdupe2.lua#L206

thegrb93 commented 1 year ago

Or change it to an AdvDupe2.IsValidDupe call