Skip to content
Commit b972e777 authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

Avoid (double) divide-by-zero.

On startup, maxValue may be 0 (e.g. for auto-adjusting sensors)
and then we get a divide-by-zero. In practice this hammers the
resulting integer to negative-biggity, but it's still undefined behavior.

Just use 0 instead.

While here, massage the C-style cast as well. Make the whole
ternary expression a double, then cast.
parent 14a7a4bc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment