Page 1 of 1

[1.1.104] 0/0 causing nan set on a circuit signal causes crash to desktop

Posted: Thu Mar 14, 2024 8:14 pm
by Mithaldu
In short, this causes a crash to desktop on the last call:

Code: Select all

        local estimate = 0 / 0
        log("estimate: ".. estimate)
        local out = {}
        table.insert(out, { signal = red_network.signals[1].signal, count = estimate, index = #out + 1 })
        struct.internal.get_control_behavior().parameters = out
Normally x / 0 results in inf, but 0 / 0 is a special case where it results in nan.

Trying to set a circuit signal to inf results in, at least, a useful ingame error. However when one accidentally ends up with 0 / 0, the resulting nan crashes the game to desktop.

Re: [1.1.104] 0/0 causing nan set on a circuit signal causes crash to desktop

Posted: Fri Mar 15, 2024 3:07 pm
by Rseding91
Thanks for the report. This will now give a standard modding error for the next release.

Re: [1.1.104] 0/0 causing nan set on a circuit signal causes crash to desktop

Posted: Sat Mar 16, 2024 8:30 pm
by Mithaldu
that was fast :D