forked from mirror/openmw-tes3mp
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
1 changed files with 6 additions and 2 deletions
|
@ -321,10 +321,14 @@ void RegionWeather::chooseNewWeather()
|
||||||
{
|
{
|
||||||
sum += mChances[i];
|
sum += mChances[i];
|
||||||
if(chance <= sum)
|
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)
|
MoonModel::MoonModel(const std::string& name, const MWWorld::Fallback& fallback)
|
||||||
|
|
Loading…
Reference in a new issue