From 3f42f0660e07976bf2f4e7247974ec714b7d80c8 Mon Sep 17 00:00:00 2001 From: "0gb.us" <0gb.us@0gb.us> Date: Wed, 10 Apr 2013 04:31:09 -0700 Subject: [PATCH] Fixed IRC crashing Minetest If an IRC client disconnected without a parting message, it crashed the Minetest server. This update fixes that. --- src/callback.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/callback.lua b/src/callback.lua index 9c431f9..6a1447e 100644 --- a/src/callback.lua +++ b/src/callback.lua @@ -1,4 +1,3 @@ - -- IRC Mod for Minetest -- By Diego Martínez -- @@ -148,7 +147,12 @@ end); irc.register_callback("part", function ( servinfo, from, part_msg ) mt_irc._callback("part", false, from, part_msg); - local text = "*** "..from.." left "..mt_irc.channel.." ("..part_msg..")"; + local text + if part_msg then + text = "*** "..from.." left "..mt_irc.channel.." ("..part_msg..")"; + else + text = "*** "..from.." left "..mt_irc.channel; + end for k, v in pairs(mt_irc.connected_players) do if (v) then minetest.chat_send_player(k, text); end end