Files
Bubberstation/code/controllers/subsystem
SyncIt21 cd4ed228f2 Fix out of bounds in lighting subsystem (#75018)
## About The Pull Request
Fixes #74697

Look at this for loop

bfba2c5934/code/controllers/subsystem/lighting.dm (L34-L39)

Now look at update corners

bfba2c5934/code/modules/lighting/lighting_source.dm (L428-L430)

Now look at refresh values. this proc has a chance to delete itself here

bfba2c5934/code/modules/lighting/lighting_source.dm (L315-L318)
And here

bfba2c5934/code/modules/lighting/lighting_source.dm (L331-L334)

Now look at the Destroy proc, specifically focus on the needs_update
condition

bfba2c5934/code/modules/lighting/lighting_source.dm (L66-L67)

We are removing the light from the subsystem source queue while the
subsystem is still iterating through them causing big problems for this
for loop

bfba2c5934/code/controllers/subsystem/lighting.dm (L33-L37)

which causes the out of bounds exception because loop variable `i` is
not updated accordingly when this list size is reduced mid iteration.

The solution? we have to move the loop variable `i` back whenever the
source is deleted i.e. removed from the list so we don't overflow

## Changelog

🆑
fix: out of bounds when updating lights in lighting subsystem
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-05-24 11:29:56 -07:00
..
2023-04-20 17:22:08 -06:00
2023-05-22 14:51:00 +12:00
2023-01-26 00:25:16 -08:00
2022-11-15 03:50:11 +00:00
2022-11-15 03:50:11 +00:00
2023-04-30 14:54:40 -07:00
2022-10-18 02:12:31 +00:00
2022-11-15 03:50:11 +00:00
2022-11-15 03:50:11 +00:00
2023-03-04 17:29:24 -08:00