From ec9a0e6d38585bedd89858ffe76e140e5521b8c5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 13 Jan 2019 09:08:08 +0200 Subject: [PATCH] Fixed: Crash in lua getWeatherValue() when continent was not loaded --HG-- branch : develop --- code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 01b4dd786..a599cd18b 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1688,7 +1688,13 @@ int CLuaIHMRyzom::getWeatherValue(CLuaState &ls) CLuaIHM::checkArgCount(ls, funcName, 0); uint64 currDay = RT.getRyzomDay(); float currHour = (float) RT.getRyzomTime(); - ls.push(::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction)); + float weather = 0.f; + if (ContinentMngr.cur()) + { + weather = ::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); + } + + ls.push(weather); return 1; }