[mcl_weather] Fix crash on saving uninitialized data, MineClone2/MineClone2#1361
This commit is contained in:
parent
7fe3217cd0
commit
66a64439c6
|
@ -38,6 +38,7 @@ mcl_weather.reg_weathers["none"] = {
|
||||||
local storage = minetest.get_mod_storage()
|
local storage = minetest.get_mod_storage()
|
||||||
-- Save weather into mod storage, so it can be loaded after restarting the server
|
-- Save weather into mod storage, so it can be loaded after restarting the server
|
||||||
local save_weather = function()
|
local save_weather = function()
|
||||||
|
if not mcl_weather.end_time then return end
|
||||||
storage:set_string("mcl_weather_state", mcl_weather.state)
|
storage:set_string("mcl_weather_state", mcl_weather.state)
|
||||||
storage:set_int("mcl_weather_end_time", mcl_weather.end_time)
|
storage:set_int("mcl_weather_end_time", mcl_weather.end_time)
|
||||||
minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time)
|
minetest.log("verbose", "[mcl_weather] Weather data saved: state="..mcl_weather.state.." end_time="..mcl_weather.end_time)
|
||||||
|
|
Loading…
Reference in New Issue