From 6e896cc9e5c7fc5a453f0aeee70692c07d169e58 Mon Sep 17 00:00:00 2001 From: Aspect <41125780+Aspect12@users.noreply.github.com> Date: Sat, 15 Jun 2024 21:58:11 +0300 Subject: [PATCH] Refactor FindPlayer() to handle empty identifier. --- gamemode/core/sh_util.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index 87f583ef0..af0b3dc9c 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -243,6 +243,8 @@ end -- @bool[opt=false] bAllowPatterns Whether or not to accept Lua patterns in `identifier` -- @treturn player Player that matches the given search query - this will be `nil` if a player could not be found function ix.util.FindPlayer(identifier, bAllowPatterns) + if (#identifier == 0) then return end + if (string.find(identifier, "STEAM_(%d+):(%d+):(%d+)")) then return player.GetBySteamID(identifier) end