Fix crash when writing a card with no description

This commit is contained in:
cheapie 2020-03-28 01:43:12 -05:00
parent 77b4fbe12d
commit 3c7e4a4f82

@ -89,7 +89,7 @@ minetest.register_node("digistuff:card_reader",{
meta:set_int("writepending",1) meta:set_int("writepending",1)
if type(msg.data) ~= "string" then msg.data = tostring(msg.data) end if type(msg.data) ~= "string" then msg.data = tostring(msg.data) end
meta:set_string("writedata",string.sub(msg.data,1,256)) meta:set_string("writedata",string.sub(msg.data,1,256))
if type(msg.description == "string") then if type(msg.description) == "string" then
meta:set_string("writedescription",string.sub(msg.description,1,64)) meta:set_string("writedescription",string.sub(msg.description,1,64))
else else
meta:set_string("writedescription","no name") meta:set_string("writedescription","no name")