CmdPal: Fix GPU index out of range crash in PerfMon widget (#48103)
## Summary Fixes #47821 The GPU Performance Monitor widget crashes with `IndexOutOfRangeException` on systems where GPU performance counters fail to enumerate (common on Intel Arc and hybrid GPU configurations). The dock band shows `???` and opening the flyout causes an error. ## Root Cause `GPUStats.CreateGPUImageUrl()` accessed `_stats[index]` without bounds checking. When `GetGPUPerfCounters()` finds no matching counter instances, `_stats` remains empty but callers still pass index 0. `GetGPUName()`, `GetGPUUsage()`, and `GetGPUTemperature()` already have proper guards (`if (_stats.Count <= index) return ...`) — this fix adds the same pattern to the one remaining unguarded method. ## Changes - `GPUStats.cs`: Add bounds check to `CreateGPUImageUrl()` — return empty string if index out of range Co-authored-by: root <root@io.bbq> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
M
Michael Jolley committed
e20b5b9c51b65a3c961019d86914a885f74706c8
Parent: c6a9ad2
Committed by GitHub <noreply@github.com>
on 6/1/2026, 6:59:57 PM