RegionLoader: check for zero sector count when loading location table

implementations shouldn't be writing location entries that have an offset but zero sectors, but just in case they do, we need to be aware of it.
This commit is contained in:
Dylan K. Taylor 2020-06-15 12:08:55 +01:00
parent 22f25dfbdb
commit b92a2ded8a

View File

@ -272,9 +272,10 @@ class RegionLoader{
for($i = 0; $i < 1024; ++$i){
$index = $data[$i + 1];
$offset = $index >> 8;
$sectorCount = $index & 0xff;
$timestamp = $data[$i + 1025];
if($offset === 0){
if($offset === 0 or $sectorCount === 0){
$this->locationTable[$i] = null;
}else{
$this->bumpNextFreeSector($this->locationTable[$i] = new RegionLocationTableEntry($offset, $index & 0xff, $timestamp));