Skip to content

Commit 2a7e460

Browse files
committed
Fix off by one in saving multipoints
Signed-off-by: Michal Čihař <[email protected]>
1 parent 914783d commit 2a7e460

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ShapeRecord.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ private function _saveMultiPointRecord() {
334334

335335
fwrite($this->SHPFile, pack('V', $this->SHPData['numpoints']));
336336

337-
for ($i = 0; $i <= $this->SHPData['numpoints']; $i++) {
337+
for ($i = 0; $i < $this->SHPData['numpoints']; $i++) {
338338
$this->_savePoint($this->SHPData['points'][$i]);
339339
}
340340
}
@@ -346,7 +346,7 @@ private function _saveMultiPointMZRecord($type) {
346346

347347
fwrite($this->SHPFile, pack('dd', $this->SHPData[$type.'min'], $this->SHPData[$type.'max']));
348348

349-
for ($i = 0; $i <= $this->SHPData['numpoints']; $i++) {
349+
for ($i = 0; $i < $this->SHPData['numpoints']; $i++) {
350350
fwrite($this->SHPFile, Util::packDouble($this->SHPData['points'][$type]));
351351
}
352352
}

0 commit comments

Comments
 (0)