mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 01:57:16 +00:00
SAGA2: Fix nullptr access in Sector iterators
This commit is contained in:
parent
ec88076e91
commit
29c5f6e749
@ -3379,6 +3379,10 @@ ObjectID SectorRegionObjectIterator::first(GameObject **obj) {
|
||||
|
||||
sectorCoords = minSector;
|
||||
currentSector = searchWorld->getSector(sectorCoords.u, sectorCoords.v);
|
||||
|
||||
if (currentSector == nullptr)
|
||||
return Nothing;
|
||||
|
||||
while (currentSector->childID == Nothing) {
|
||||
if (++sectorCoords.v >= maxSector.v) {
|
||||
sectorCoords.v = minSector.v;
|
||||
@ -3625,12 +3629,18 @@ ObjectID RegionalObjectIterator::first(GameObject **obj) {
|
||||
ObjectID currentObjectID;
|
||||
|
||||
currentObjectID = SectorRegionObjectIterator::first(¤tObject);
|
||||
|
||||
if (currentObjectID == Nothing)
|
||||
return Nothing;
|
||||
|
||||
while (currentObjectID != Nothing
|
||||
&& !inRegion(currentObject->getLocation())) {
|
||||
currentObjectID = SectorRegionObjectIterator::next(¤tObject);
|
||||
}
|
||||
|
||||
if (obj != nullptr) *obj = currentObject;
|
||||
if (obj != nullptr)
|
||||
*obj = currentObject;
|
||||
|
||||
return currentObjectID;
|
||||
}
|
||||
|
||||
|
@ -1463,7 +1463,7 @@ void PathRequest::initialize(void) {
|
||||
baseCoords.v
|
||||
+ (searchCenter << kTileUVShift) * 2,
|
||||
0));
|
||||
GameObject *obj;
|
||||
GameObject *obj = nullptr;
|
||||
|
||||
for (iter.first(&obj);
|
||||
obj != nullptr;
|
||||
@ -2497,7 +2497,7 @@ TilePoint selectNearbySite(
|
||||
baseCoords.v
|
||||
+ (searchCenter << kTileUVShift) * 2,
|
||||
0));
|
||||
GameObject *obj;
|
||||
GameObject *obj = nullptr;
|
||||
|
||||
for (iter.first(&obj);
|
||||
obj != nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user