mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +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:
parent
091ca9743e
commit
0b84b3c2cf
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user