mirror of https://github.com/OpenTTD/OpenTTD
Fix: Out-of-bounds read, if NewGRF stations provided no spritesets.
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