diff --git a/inferium-server.lua b/inferium-server.lua index 2f35dc4..db3d3f2 100644 --- a/inferium-server.lua +++ b/inferium-server.lua @@ -3,7 +3,7 @@ local utils = require('libs/utils') local inferium = require('config/inferium') local DEFAULT_HARVESTER_NAME = 'harvester' -local VERSION = "2.0.2" +local VERSION = "2.0.3" local INFERIUM_SERVER = 'inferium.com' local PERSISTED_CONFIGS = '/data/inferium-configs' @@ -52,8 +52,11 @@ local function saveConfigForComputer(computerId, config) end -- Utils - local function getConfigWithLength(config) + if not config then + return config + end + local configWithLength = utils.shallowClone(config) configWithLength.length = utils.sizeof(config.plan) diff --git a/libs/utils.lua b/libs/utils.lua index 423981a..6a99260 100644 --- a/libs/utils.lua +++ b/libs/utils.lua @@ -41,10 +41,15 @@ utils.shallowDiff = function(a, b) end utils.shallowClone = function(t) + if not t then + return t + end + local res = {} for k,v in pairs(t) do res[k] = v end + return res end