TeamUlysses / ulib

ULib: A Lua library for more rapid development on Garry's Mod servers
http://ulyssesmod.net
Other
104 stars 55 forks source link

Parsing player/players argument sometimes fails when ply is NULL #36

Closed Timmy closed 7 years ago

Timmy commented 7 years ago

Steps to reproduce

  1. Create a command with a cmds.PlayerArg or cmds.PlayersArg as an cmds.optional argument.
    -- lua/ulib/modules/test.lua
    local test = ULib.cmds.TranslateCommand( "test", print )
    test:addParam{ type=ULib.cmds.PlayerArg, ULib.cmds.optional }
    test:defaultAccess( ULib.ACCESS_ALL )
  2. Call the command from the server console without arguments.

Expected behavior

The command executes.

Actual behavior

The following error gets thrown:

[ERROR] addons/ulib/lua/ulib/shared/player.lua:121: Tried to use a NULL entity!
  1. indexFn - [C]:-1
   2. getUniqueIDForPlayer - addons/ulib/lua/ulib/shared/player.lua:121
    3. parseAndValidate - addons/ulib/lua/ulib/shared/commands.lua:515
     4. __fn - addons/ulib/lua/ulib/shared/commands.lua:916
      5. execute - addons/ulib/lua/ulib/shared/commands.lua:1323
       6. unknown - addons/ulib/lua/ulib/shared/commands.lua:1351
        7. unknown - lua/includes/modules/concommand.lua:54

Version

ULib v2.63d (03/21/17) ULX v3.73d (03/21/17)