Sokomine / travelnet

network of teleporter-boxes that allow easy travelling to other boxes on the same network (Mod for Minetest)
GNU General Public License v3.0
30 stars 52 forks source link

Use safe_write_file, backup damaged network files #35

Closed SmallJoker closed 5 years ago

SmallJoker commented 6 years ago

I tried to adapt your code style, please tell me when there's something to change. A user reported the following error:

2018-10-28 01:12:52: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'travelnet' in callback node_on_receive_fields(): .../survivalneu/minetest/bin/../mods/travelnet/init.lua:529: attempt to index field 'targets' (a nil value)                                                                                                                                                            
2018-10-28 01:12:52: ERROR[Main]: stack traceback:                                                                                                                                                              
2018-10-28 01:12:52: ERROR[Main]:       .../survivalneu/minetest/bin/../mods/travelnet/init.lua:529: in function 'add_target'                                                                                   
2018-10-28 01:12:52: ERROR[Main]:       .../survivalneu/minetest/bin/../mods/travelnet/init.lua:661: in function <.../survivalneu/minetest/bin/../mods/travelnet/init.lua:633> 

Most likely it's the file which was damaged (de-serialization returned nil).

SmallJoker commented 5 years ago

Thank you!