Fix crash on passing false as value in table to table.copy(t)
authorest31 <MTest31@outlook.com>
Thu, 12 Feb 2015 21:03:24 +0000 (22:03 +0100)
committerCraig Robbins <kde.psych@gmail.com>
Sat, 14 Feb 2015 05:18:11 +0000 (15:18 +1000)
Fixes #2293.

builtin/common/misc_helpers.lua

index deeba788ea49ae551e62c6b7f550b0556f1479c7..d9ebc39c3dbc5e618c3a6b0dcf13c5746397130f 100644 (file)
@@ -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
 --------------------------------------------------------------------------------