Fix placing sign with empty text getting "nil"

This commit is contained in:
Elias Åström 2024-08-18 13:00:45 +02:00 committed by Mikita Wiśniewski
parent f2028670cf
commit 66887d044e

View file

@ -320,7 +320,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
if not mcl_util.check_position_protection(pos, player) and (signs_editable or minetest.get_meta(pos):get_string("text") == "") then
set_signmeta(pos,{
text = tostring(fields.text):sub(1, 256), --limit saved text to 256 characters (4 lines x 15 chars = 60 so this should be more than is ever needed).
text = tostring(fields.text or ""):sub(1, 256), --limit saved text to 256 characters (4 lines x 15 chars = 60 so this should be more than is ever needed).
})
mcl_signs.update_sign(pos)
end