1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 07:19:41 +00:00

Don't crash when region weather chances don't add to 100

The invalid weather ID was resulting in out-of-bounds vector access later in the code.
This commit is contained in:
scrawl 2016-01-14 17:41:39 +01:00
parent 091ca9743e
commit 0b84b3c2cf

View file

@ -321,10 +321,14 @@ void RegionWeather::chooseNewWeather()
{
sum += mChances[i];
if(chance <= sum)
break;
{
mWeather = i;
return;
}
}
mWeather = i;
// if we hit this path then the chances don't add to 100, choose a default weather instead
mWeather = 0;
}
MoonModel::MoonModel(const std::string& name, const MWWorld::Fallback& fallback)