prevent div by zero

main
Benjamin Kraft 1 year ago
parent 5bce7a29ae
commit 9e123367ee
  1. 5
      src/FPS.cpp

@ -25,7 +25,10 @@ void FPS::setUpdateInterval(int milli) {
}
void FPS::updateCurrent() {
current = framesSinceUpdate * 1000 * 1000 * 1000 / timeSinceUpdate.count();
if (timeSinceUpdate.count() == 0)
current = 0;
else
current = framesSinceUpdate * 1000 * 1000 * 1000 / (timeSinceUpdate.count());
framesSinceUpdate = 0;
timeSinceUpdate = nanoseconds(0);
}

Loading…
Cancel
Save