Skip to content

Commit

Permalink
Prevent a division by zero error (#57)
Browse files Browse the repository at this point in the history
* Prevent a division by zero error

* Updating divide by zero fix based on Adrian's suggestion.

* Remove trailing spaces
  • Loading branch information
alexfraundorf-com authored and adriangibbons committed Sep 12, 2019
1 parent 1acf349 commit 0efa4f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/phpFITFileAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,9 @@ private function setUnits($options)
}
}
} else {
if ($this->data_mesgs[$message][$field] === 0) { // Prevent divide by zero error
continue;
}
if ($bPace) {
$this->data_mesgs[$message][$field] = round(60 / 3.6 / $this->data_mesgs[$message][$field], 3);
} else {
Expand Down

0 comments on commit 0efa4f0

Please sign in to comment.