Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Eldrinn-Elantey opened this issue Apr 7, 2024 · 1 comment · May be fixed by #180
Open

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

Eldrinn-Elantey opened this issue Apr 7, 2024 · 1 comment · May be fixed by #180
Labels

Comments

@Eldrinn-Elantey
Copy link

Eldrinn-Elantey commented Apr 7, 2024

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)
@Eldrinn-Elantey Eldrinn-Elantey changed the title [] [CRASH] Error while running event YARM::on_tick (ID 0) Apr 7, 2024
@narc0tiq
Copy link
Owner

I think I see what could have happened here:

YARM/resmon.lua

Lines 462 to 465 in 06c7ddb

for i = 1, to_scan do
local entity = table.remove(site.next_to_scan, 1)
local entity_position = entity.position
local surface = entity.surface

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.

narc0tiq added a commit that referenced this issue Oct 30, 2024
Just a simple guard clause to make sure that if an entity is mined away while we're scanning the site, we don't crash by trying to access something that doesn't exist.

Fixes #170
@narc0tiq narc0tiq linked a pull request Oct 30, 2024 that will close this issue
@narc0tiq narc0tiq added the bug label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants