From: est31 Date: Thu, 12 Feb 2015 21:03:24 +0000 (+0100) Subject: Fix crash on passing false as value in table to table.copy(t) X-Git-Tag: 0.4.13~616 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7c5accf60501e0ff7fd8f44af963b71da9ac8045;p=oweals%2Fminetest.git Fix crash on passing false as value in table to table.copy(t) Fixes #2293. --- diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index deeba788e..d9ebc39c3 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -545,12 +545,11 @@ function table.copy(t, seen) seen = seen or {} seen[t] = n for k, v in pairs(t) do - n[type(k) ~= "table" and k or seen[k] or table.copy(k, seen)] = - type(v) ~= "table" and v or seen[v] or table.copy(v, seen) + n[(type(k) == "table" and (seen[k] or table.copy(k, seen))) or k] = + (type(v) == "table" and (seen[v] or table.copy(v, seen))) or v end return n end - -------------------------------------------------------------------------------- -- mainmenu only functions --------------------------------------------------------------------------------