narc0tiq / YARM

Yet another variant of the Resource Monitor for Factorio
https://mods.factorio.com/mod/YARM
MIT License
54 stars 42 forks source link

[CRASH] Error while running event YARM::on_tick (ID 0) #170

Open Eldrinn-Elantey opened 7 months ago

Eldrinn-Elantey commented 7 months ago
21433.725 Error MainLoop.cpp:1404: Exception at tick 78463607: Мод YARM - Resource Monitor (0.10.14) вызвал неустранимую ошибку.
Пожалуйста, сообщите об этой ошибке автору мода.

Error while running event YARM::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
    [C]: in function '__index'
    __YARM__/resmon.lua:453: in function 'scan_current_site'
    __YARM__/resmon.lua:1676: in function 'update_players'
    __YARM__/resmon.lua:1733: in function 'on_tick_internal'
    __YARM__/resmon.lua:1767: in function <__YARM__/resmon.lua:1762>
21433.725 Error ClientMultiplayerManager.cpp:100: MultiplayerManager failed: "Мод YARM - Resource Monitor (0.10.14) вызвал неустранимую ошибку.
Пожалуйста, сообщите об этой ошибке автору мода.

Error while running event YARM::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
    [C]: in function '__index'
    __YARM__/resmon.lua:453: in function 'scan_current_site'
    __YARM__/resmon.lua:1676: in function 'update_players'
    __YARM__/resmon.lua:1733: in function 'on_tick_internal'
    __YARM__/resmon.lua:1767: in function <__YARM__/resmon.lua:1762>"
21433.725 Info ClientMultiplayerManager.cpp:616: UpdateTick(78463607) changing state from(InGame) to(Failed)
narc0tiq commented 6 days ago

I think I see what could have happened here: https://github.com/narc0tiq/YARM/blob/06c7ddb2521001af4077dba6043bcc20153f4d3c/resmon.lua#L462-L465

We take the next entity from next_to_scan and assume it still exists but any number of ticks may have passed since it was added -- the entity might have been mined away, especially with a particularly fast miner. Should be a relatively easy fix.