diff --git a/bot/utils.lua b/bot/utils.lua index 1485132..005e93e 100644 --- a/bot/utils.lua +++ b/bot/utils.lua @@ -441,9 +441,11 @@ end -- Returns a table with matches or nil function match_pattern(pattern, text) - local matches = { string.match(text, pattern) } - if next(matches) then - return matches + if text then + local matches = { string.match(text, pattern) } + if next(matches) then + return matches + end end -- nil end