From 17cde44ef62156d61cb3479cdbf9a99cb944e382 Mon Sep 17 00:00:00 2001 From: masterdraco Date: Thu, 8 Oct 2026 19:26:46 +0200 Subject: [PATCH] fix: forsynings-diagnose robust (pcall, varekatalog uden metode) (v1.62.92) --- FS25_ADSmartPickup/adSmartPickup.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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