Skip to content
Commit c9f9c144 authored by Natalia Pluta's avatar Natalia Pluta Committed by Alberto Escolar
Browse files

samples: net: cellular_modem: fix division by zero in sample_echo_packet



A hard fault occurs when the `sample_echo_packet` function attempts
to print the average time per successful echo and no packets have
been sent, resulting in a division by zero error. This fix adds a check
to ensure that `packets_sent` is greater than 0 before performing
the division. This prevents the system from halting due to a usage fault.

Signed-off-by: default avatarNatalia Pluta <pluta.natalia.m@gmail.com>
parent 794d7cf3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment