fix a crash when pressing printscrn!

This commit is contained in:
a 2024-12-05 02:40:37 +02:00
parent 90cac09c12
commit 7be7f770bd

View File

@ -22,7 +22,11 @@ void Steam_Overlay_Stats::update_frametime(const std::chrono::high_resolution_cl
if (last_frametime_idx >= (settings->overlay_fps_avg_window - 1)) { if (last_frametime_idx >= (settings->overlay_fps_avg_window - 1)) {
last_frametime_idx = 0; last_frametime_idx = 0;
active_frametime_ms = static_cast<float>(running_frametime_ms) / settings->overlay_fps_avg_window; active_frametime_ms = static_cast<float>(running_frametime_ms) / settings->overlay_fps_avg_window;
if (running_frametime_ms > 0) {
active_fps = static_cast<unsigned>((1000 * settings->overlay_fps_avg_window) / running_frametime_ms); active_fps = static_cast<unsigned>((1000 * settings->overlay_fps_avg_window) / running_frametime_ms);
} else { // happens when avg window =1, no idea why!
active_fps = 999;
}
running_frametime_ms = 0; running_frametime_ms = 0;
} else { } else {
++last_frametime_idx; ++last_frametime_idx;