[boskid] [2.0.19] Crash with order_deconstruction (possible index out of bounds)

This subforum contains all the issues which we already resolved.
User avatar
Yodo
Inserter
Inserter
Posts: 24
Joined: Sat Dec 30, 2023 4:27 pm
Contact:

[boskid] [2.0.19] Crash with order_deconstruction (possible index out of bounds)

Post by Yodo »

Steps to reproduce:
1. Load the attached mod file and then load the attached game.
2. Mark one or both of the "Linked Fast underground belt" in the middle of the screen for deconstruction (make sure instant deconstruct is off) (if alt-mode is on they should be linked by a white line)

What happens:
Bots come to deconstruct the Linked Fast underground belts (expected), and when they arrive the game crashes (unexpected).

Does it always happen?
With the steps above, it happend every time I tried it; 4/4 times.


I think this is because of

Code: Select all

lbn.order_deconstruction(lbn.force, event.player_index, 1)
on line 103 of the control.lua of the mod, as if you remove the third argument the steps above do not cause a crash. Also, when trying to replicate the crash in a new wave I got an index-out-of-bounds error instead of a crash.

I also attached the log and dump files.

I thought an index of 1 would be allowed, as the docs say "An index of 1 adds the action to the latest undo action on the stack."
Attachments
factorio-dump-current.dmp
(790.45 KiB) Downloaded 6 times
factorio-current.log
(12.77 KiB) Downloaded 7 times
LinkedBelts_0.1.0.zip
mod file
(1.44 MiB) Downloaded 6 times
sandbox_test_mods.zip
save file
(11.65 MiB) Downloaded 10 times
Have you considered using flow routers instead of balancers?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2964
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.19] Crash with order_deconstruction (possible index out of bounds)

Post by boskid »

Thanks for the report. Issue is now fixed for 2.0.20.

Its a trivial implementation mistake on the LuaEntity side where the code simply tries to dereference nullptr when using LuaEntity::order_deconstruction when second parameter (player_index) is given as `nil` but third parameter is specified.
Post Reply

Return to “Resolved Problems and Bugs”