Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 0efa4f0

Browse files
alexfraundorf-comadriangibbons
authored andcommitted
Prevent a division by zero error (#57)
* Prevent a division by zero error * Updating divide by zero fix based on Adrian's suggestion. * Remove trailing spaces
1 parent 1acf349 commit 0efa4f0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/phpFITFileAnalysis.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,6 +1966,9 @@ private function setUnits($options)
19661966
}
19671967
}
19681968
} else {
1969+
if ($this->data_mesgs[$message][$field] === 0) { // Prevent divide by zero error
1970+
continue;
1971+
}
19691972
if ($bPace) {
19701973
$this->data_mesgs[$message][$field] = round(60 / 3.6 / $this->data_mesgs[$message][$field], 3);
19711974
} else {

0 commit comments

Comments
 (0)