Hello! I encountered a non-recoverable error when running this mod alongside a large list of other mods.
Error:
Error while running event resource-map-label-marker-fork::on_init()
resource-map-label-marker-fork/global_lib.lua:52: attempt to compare two nil values
stack traceback:
resource-map-label-marker-fork/global_lib.lua:52: in function <resource-map-label-marker-fork/global_lib.lua:51>
[C]: in function 'sort'
resource-map-label-marker-fork/global_lib.lua:55: in function 'calculateIconTypes'
resource-map-label-marker-fork/control.lua:453: in function <resource-map-label-marker-fork/control.lua:452>
Cause
The crash happens during M.calculateIconTypes() because some custom mods introduce mining products that do not explicitly define a .probability key. When table.sort attempts to compare them, it encounters nil and panics.
Suggested Fix
Adding a fallback value (like 1) inside the sorter function fixes the crash completely. In global_lib.lua, lines 51-55 can be updated to:
local products = value.mineable_properties.products or {}
local sorter = function(a, b)
local prob_a = a.probability or 1
local prob_b = b.probability or 1
return prob_a < prob_b
end
table.sort(products, sorter)
Tested and working for me.