Fix error if `@` with no name is used.

This commit is contained in:
Diego Martínez 2017-02-16 02:38:44 -03:00
parent 33542b07fe
commit 78fbe26a2c
1 changed files with 3 additions and 1 deletions

View File

@ -41,7 +41,9 @@ function irc:bot_command(msg, text)
text = text:match("^%s*(.*)")
if text:sub(1, 1) == "@" then
local _, _, player_to, message = text:find("^.([^%s]+)%s(.+)$")
if not minetest.get_player_by_name(player_to) then
if not player_to then
return
elseif not minetest.get_player_by_name(player_to) then
irc:reply("User '"..player_to.."' is not in the game.")
return
elseif not irc.joined_players[player_to] then