fix: forsynings-diagnose robust (pcall, varekatalog uden metode) (v1.62.92)

This commit is contained in:
2026-10-08 19:26:46 +02:00
parent e3cc0d84f5
commit 17cde44ef6
+3 -2
View File
@@ -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