Qt: Better fps non-zero division check

This commit is contained in:
Vicki Pfau 2023-03-01 23:11:23 -08:00
parent f45b4e3ef0
commit 001135ef91
1 changed files with 4 additions and 4 deletions

View File

@ -1138,14 +1138,14 @@ void Window::recordFrame() {
}
void Window::showFPS() {
if (m_frameList.isEmpty()) {
updateTitle();
return;
}
qint64 total = 0;
for (qint64 t : m_frameList) {
total += t;
}
if (!total) {
updateTitle();
return;
}
double fps = (m_frameList.size() * 1e10) / total;
m_frameList.clear();
fps = round(fps) / 10.f;