Skip to content

Commit

Permalink
Protect against divide-by-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
fhunleth committed Feb 17, 2023
1 parent 42fd7c4 commit 1e56dfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib_src/core/speed_test.ex
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ defmodule Toolshed.Core.SpeedTest do
end

defp update_status(state, received, now, next_status_us) do
delta_us = now - state.start_us
delta_us = max(now - state.start_us, 1)
bps = received * 8 * 1.0e6 / delta_us
["\r--> ", format(bps), " "] |> IO.write()

Expand Down

0 comments on commit 1e56dfe

Please sign in to comment.