From 00df91dc09f8ec68fc1b90efb3be5475af22a538 Mon Sep 17 00:00:00 2001 From: Earu Date: Sat, 17 Dec 2022 13:35:49 +0100 Subject: [PATCH] fix a rare bug with mentions --- lua/easychat/modules/client/mentions.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/easychat/modules/client/mentions.lua b/lua/easychat/modules/client/mentions.lua index b972211..3e061a9 100644 --- a/lua/easychat/modules/client/mentions.lua +++ b/lua/easychat/modules/client/mentions.lua @@ -232,7 +232,11 @@ function mentions:IsMention(msg) local stripped_msg = ec_markup.GetText(msg):lower() if filter_match(stripped_msg) then return true end - local ply_name = LocalPlayer():Nick():lower():PatternSafe() + local ply = LocalPlayer() + if not IsValid(ply) then return false end + if not ply.Nick then return false end + + local ply_name = (ply:Nick() or ""):lower():PatternSafe() local nick_mention = stripped_msg:match(ply_name) local is_nick_match = not stripped_msg:match("^[%!%.%/]") and nick_mention return is_nick_match and #nick_mention > 1