mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-25 14:40:10 +01:00
Fix: Out-of-bounds read, if NewGRF stations provided no spritesets.
This commit is contained in:
parent
0f1ef96ca1
commit
0c6426cb2d
@ -522,7 +522,8 @@ uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &, uint8_t variable, [
|
|||||||
/* virtual */ const SpriteGroup *StationResolverObject::ResolveReal(const RealSpriteGroup *group) const
|
/* virtual */ const SpriteGroup *StationResolverObject::ResolveReal(const RealSpriteGroup *group) const
|
||||||
{
|
{
|
||||||
if (this->station_scope.st == nullptr || !Station::IsExpected(this->station_scope.st)) {
|
if (this->station_scope.st == nullptr || !Station::IsExpected(this->station_scope.st)) {
|
||||||
return group->loading[0];
|
if (!group->loading.empty()) return group->loading[0];
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint cargo = 0;
|
uint cargo = 0;
|
||||||
@ -564,7 +565,8 @@ uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &, uint8_t variable, [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return group->loading[0];
|
if (!group->loading.empty()) return group->loading[0];
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrfSpecFeature StationResolverObject::GetFeature() const
|
GrfSpecFeature StationResolverObject::GetFeature() const
|
||||||
|
Loading…
Reference in New Issue
Block a user