diff --git a/FS25_ADSmartPickup/adSmartPickup.lua b/FS25_ADSmartPickup/adSmartPickup.lua index f106b74..04fcdee 100644 --- a/FS25_ADSmartPickup/adSmartPickup.lua +++ b/FS25_ADSmartPickup/adSmartPickup.lua @@ -806,7 +806,7 @@ local function logSupplyMiss(driver, ranked, bestFood, markerStations, farmId) end end end - local fillType = g_fillTypeManager ~= nil and g_fillTypeManager:getFillTypeByIndex(need.fillType) or nil + local fillType = g_fillTypeManager ~= nil and g_fillTypeManager.getFillTypeByIndex ~= nil and g_fillTypeManager:getFillTypeByIndex(need.fillType) or nil table.insert(parts, string.format("%s: fri %.0f l, %s, %d kilder med lager (bedst %.0f l), %d beskyttet produktionsinput", fillType ~= nil and fillType.name or tostring(need.fillType), need.freeSpace or 0, allowed and "tilladt" or "IKKE tilladt (bedre foder findes)", withStock, bestLevel, protected)) @@ -871,7 +871,8 @@ function ADSmartPickup.findSupplyPickup(adEnv, driver, ingredients, targetWayPoi } end end - logSupplyMiss(driver, ranked, bestFood, markerStations, farmId) + local okLog, errLog = pcall(logSupplyMiss, driver, ranked, bestFood, markerStations, farmId) + if not okLog then Logging.warning(ADSmartPickup.LOG_PREFIX .. "forsynings-diagnose: %s", tostring(errLog)) end return nil end