Closed dkowis closed 9 years ago
I had to delete a turbine configuration, somehow it decided there was more than one :(
Do you have two modems to a single Turbine? Were there two Turbines at some point? Was the program restarted after a Turbine was added/removed? The program auto-discovers connected devices every loop and should only crash if the devices (monitors, turbines, reactors, etc.) are added/removed while it's running.
Only one turbine ever. Never had two modems on it. Program was restarted after turbine added.
Nothing was changed, I leave it running for a long time and come back and it's le crashed :(
From what I can see in the code, that's trying to refer to a Turbine that your computer reported as being attached and was found by the program, and then when trying to save that second Turbine's information, we get an out-of-bounds error (nil).
Was your Turbine perhaps attached to a different modem earlier (e.g. you replaced the modem connecting it) and so got a different ID from ComputerCraft and shows as a different Turbine (even if you only have one)? The function findTurbines() loads the config files based on name, see https://github.com/sandalle/minecraft_bigreactor_control/blob/master/lolmer_bigreactor_monitor_prog.lua#L917.
that might have happened....
In config.load(path) we check if the file is opened properly for read and return "nil" if not, and then in findTurbines() we try to load that file, but if it's nil we then create the file with default values so it's valid on the next run. So unless turbineIndex somehow changed while the program is running, we should not be indexing nil.
Does this still happen after removing the file? Can you try replacing the modem to get a new Turbine ID from ComputerCraft and see if you can reproduce the error? Line 916 from release 0.3.16 is checking for LastSpeed, which has a default value set on Line 889 from release 0.3.16 and so should not be nil as we only overwrite the default value if the value loaded from the config (if the config is not nil) is also not nil.
@dkowis Could you test with my test branch which has the code commit from above and debugMode=true and then try to replicate? :) You can just modify your startup script to download the pastebin above instead of the stable code.
Please re-open if you can duplicate the bug and provide the debug log so that we can track it down, but I cannot replicate the issue here.
Don't know why it doesn't work, yet:![failure](http://i.imgur.com/jTEOYrl.png)
Although there should only be one turbine, not two...