diff options
author | est31 <MTest31@outlook.com> | 2015-02-12 22:03:24 +0100 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-02-14 15:24:09 +1000 |
commit | 61588a43dd61b48383823b7fa948ece4d8dd357e (patch) | |
tree | ad1134d084c0f53a5b825a7633753c4c74655e18 /builtin/common | |
parent | e62927ed71c557cd885fce03fbc34bb6020089a3 (diff) | |
download | minetest-61588a43dd61b48383823b7fa948ece4d8dd357e.tar.gz minetest-61588a43dd61b48383823b7fa948ece4d8dd357e.tar.bz2 minetest-61588a43dd61b48383823b7fa948ece4d8dd357e.zip |
Fix crash on passing false as value in table to table.copy(t)
Fixes #2293.
Diffstat (limited to 'builtin/common')
-rw-r--r-- | builtin/common/misc_helpers.lua | 5 |
1 files changed, 2 insertions, 3 deletions
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 -------------------------------------------------------------------------------- |