raiguard / UltimateResearchQueue

Advanced Factorio research queue GUI.
MIT License
3 stars 5 forks source link

Ultimate Research Queue (1.0.12) not checking for nil technology in util.should_show #17

Open angrypidgeon123 opened 5 months ago

angrypidgeon123 commented 5 months ago

after I eliminated a bunch of mod breaking technologies from modmashsplinterresources_1.1.13 by adding this line to types.lua line 171

if starts_with(resource.minable.result,"se-") then break end

I ran into Ultimate Research Queue (1.0.12) not checking for nil values on technologies

so I added if technology == nil return end

in function util.should_show

Now it works... for me only :D

 285.220 Error AppManagerStates.cpp:1659: The mod Module Inserter Extended (6.1.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event ModuleInserterEx::on_configuration_changed
The mod Ultimate Research Queue (1.0.12) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event UltimateResearchQueue::on_gui_closed (ID 89)
__UltimateResearchQueue__/util.lua:125: attempt to index local 'technology' (a nil value)
stack traceback:
    __UltimateResearchQueue__/util.lua:125: in function 'should_show'
    __UltimateResearchQueue__/gui.lua:90: in function 'filter_tech_list'
    __UltimateResearchQueue__/gui.lua:349: in function 'toggle_search'
    __UltimateResearchQueue__/gui.lua:235: in function 'handler'
    __UltimateResearchQueue__/gui.lua:991: in function 'wrapper'
    __flib__/gui-lite.lua:139: in function 'handler'
    __flib__/gui-lite.lua:169: in function 'dispatch'
    __UltimateResearchQueue__/control.lua:92: in function <__UltimateResearchQueue__/control.lua:91>
stack traceback:
    [C]: in function '__newindex'
    __ModuleInserterEx__/scripts/gui.lua:532: in function 'destroy'
    __ModuleInserterEx__/control.lua:760: in function <__ModuleInserterEx__/control.lua:755>
raiguard commented 4 months ago

This function should never receive a nil technology. Can you post a save file and exact reproduction steps?

angrypidgeon123 commented 4 months ago

My save game may just confuse you, I have 438 mod files and everyone reported not being able to make all mods work or at all :D

I simply added a null check to exit the function as usual when I get that error in other mods, and continued my game. Never had a problem since.

if technology == nil then return end

Haven't entered in factorio for a while, and will be busy a while too to test more, but played a while after without problems

raiguard commented 4 months ago

Again, this function should never receive a nil technology. Adding that fix does not solve the underlying issue, it just hides it.

Please send a save file and exact reproduction steps.