Skip to content

Commit b20cd79

Browse files
committed
Fixing bug (SIGSEV), accidentially writing to address zero.
1 parent bd45c29 commit b20cd79

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/CAN/src/CanUtil.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ std::tuple<bool, uint32_t, uint32_t, uint32_t, uint32_t> calc_can_bit_timing(Can
4747
/* Determine the CAN baud rate prescaler. */
4848
double const brp = static_cast<double>(can_clock_Hz) / (tq * static_cast<double>(can_bitrate));
4949
/* Extract the sub-comma part of the baud rate prescaler. */
50-
double const brp_fract = modf(brp, nullptr);
50+
double brp_ipart;
51+
double const brp_fract = modf(brp, &brp_ipart);
5152
/* If the fractional part is sufficiently close to zero, we have
5253
* found a valid prescaler configuration.
5354
*/

0 commit comments

Comments
 (0)