fix(xgameruntime): guard frame_counter against 0 ms division, non-finite elapsed, and empty CSV path #375

Manually merged
github merged 1 commit from github-bot/gh-375 into gh-pr/375/base 2026-11-26 14:01:10 +00:00 AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 13:46 UTC · original
Lewandox:fix/xgameruntime-frame-counter-zero-div → main · +26 −5 · 1 files · 1 commits · merged 2026-11-26 13:57 UTC

Summary

Fixes three edge-case bugs in crates/anyxboxx-xgameruntime/src/frame_counter.rs:

  1. Division by zero on slowest_ms == 0.0: 1000.0 / report.slowest_ms produced inf in trace logs and the window title (1 % bas inf) when frames completed within the same monotonic clock tick. Extracted low_fps(slowest_ms: f64) -> f64 returning 0.0 when slowest_ms is non-positive or non-finite.
  2. Non-finite elapsed in summarise: summarise only checked elapsed <= 0.0, accepting f64::INFINITY or f64::NAN. Now rejects !elapsed.is_finite() || elapsed <= 0.0.
  3. Empty ANYXBOXX_FPS_CSV: write_csv now ignores an empty ANYXBOXX_FPS_CSV environment variable instead of attempting to open "".

Verification

  • cargo fmt -p anyxboxx-xgameruntime -- --check — pass
  • cargo clippy -p anyxboxx-xgameruntime --no-deps --all-targets -- -D warnings — pass
  • cargo test -p anyxboxx-xgameruntime frame_counter::tests — all passed, 0 failed
**@⁠Lewandox** on GitHub · 2026-11-26 13:46 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/375) `Lewandox:fix/xgameruntime-frame-counter-zero-div` → `main` · +26 −5 · 1 files · 1 commits · merged 2026-11-26 13:57 UTC ## Summary Fixes three edge-case bugs in `crates/anyxboxx-xgameruntime/src/frame_counter.rs`: 1. **Division by zero on `slowest_ms == 0.0`**: `1000.0 / report.slowest_ms` produced `inf` in trace logs and the window title (`1 % bas inf`) when frames completed within the same monotonic clock tick. Extracted `low_fps(slowest_ms: f64) -> f64` returning `0.0` when `slowest_ms` is non-positive or non-finite. 2. **Non-finite `elapsed` in `summarise`**: `summarise` only checked `elapsed <= 0.0`, accepting `f64::INFINITY` or `f64::NAN`. Now rejects `!elapsed.is_finite() || elapsed <= 0.0`. 3. **Empty `ANYXBOXX_FPS_CSV`**: `write_csv` now ignores an empty `ANYXBOXX_FPS_CSV` environment variable instead of attempting to open `""`. ### Verification - `cargo fmt -p anyxboxx-xgameruntime -- --check` — pass - `cargo clippy -p anyxboxx-xgameruntime --no-deps --all-targets -- -D warnings` — pass - `cargo test -p anyxboxx-xgameruntime frame_counter::tests` — all passed, 0 failed
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:49:43 +00:00
github-bot changed target branch from main to gh-pr/375/base 2026-11-26 14:01:09 +00:00
github manually merged commit afcc336ddb into gh-pr/375/base 2026-11-26 14:01:10 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.