Add clamping at 99999 to the FPS counter (#932)

This commit is contained in:
John S 2025-08-26 19:31:59 -04:00 committed by GitHub
parent e74ea05fde
commit c0e03a2ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ struct DjuiFpsDisplay *sFpsDisplay = NULL;
void djui_fps_display_update(u16 fps) { void djui_fps_display_update(u16 fps) {
if (configShowFPS && sFpsDisplay != NULL) { if (configShowFPS && sFpsDisplay != NULL) {
char fpsText[30] = ""; char fpsText[30] = "";
fps = fps > 99999 ? 99999 : fps; // Prevent overflowing the FPS display (cap at 99999)
snprintf(fpsText, 30, "\\#dcdcdc\\FPS: \\#ffffff\\%d", fps); snprintf(fpsText, 30, "\\#dcdcdc\\FPS: \\#ffffff\\%d", fps);
djui_text_set_text(sFpsDisplay->text, fpsText); djui_text_set_text(sFpsDisplay->text, fpsText);
} }