Skip to content

Commit

Permalink
Avoid processing data in case of read failure
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Sep 5, 2016
1 parent a666f7d commit d2334fa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ShapeRecord.php
Expand Up @@ -199,8 +199,15 @@ private function _loadData($type, $count)

private function _loadHeaders() {
$this->recordNumber = $this->_loadData('N', 4);
if ($this->recordNumber === false) {
return;
}
// We read the length of the record
$this->size = $this->_loadData('N', 4) * 2 + 8;
$this->size = $this->_loadData('N', 4);
if ($this->size === false) {
return;
}
$this->size = $this->size * 2 + 8;
$this->shapeType = $this->_loadData('V', 4);
}

Expand Down

0 comments on commit d2334fa

Please sign in to comment.