Skip to content

Status icons: fix AFK-cache crash on secret unit GUIDs#141

Open
Krathe82 wants to merge 1 commit into
DanderBot:mainfrom
Krathe82:pr/afk-secret-key-crash
Open

Status icons: fix AFK-cache crash on secret unit GUIDs#141
Krathe82 wants to merge 1 commit into
DanderBot:mainfrom
Krathe82:pr/afk-secret-key-crash

Conversation

@Krathe82

@Krathe82 Krathe82 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Problem

A unit's GUID can be a secret value in 12.0, and a secret value cannot be used as a table key. The AFK status caches are keyed by GUID (afkStateCache[key], afkStartTimes[key]), so any unit whose GUID was secret crashed UpdateAFKIcon / ClearAFKCache with:

attempted to perform indexed assignment on a table that cannot be indexed with secret keys

(reported 13× on live). The code already guarded canaccessvalue on the AFK/DND results, but never on the cache key itself.

Fix

GetAFKKey now returns the GUID only when it is accessible (canaccessvalue, checked before any truthiness test on the GUID — a secret can't be evaluated in a boolean context) and falls back to the unit token, a plain string that is never secret, otherwise. Every cache read, write, and ClearAFKCache flows through GetAFKKey, so this one change covers them all. Normal units keep GUID-based keying (stable across unit-token reassignment); the rest get a safe key instead of a crash.

A unit's GUID can be a SECRET value in 12.0, and a secret cannot be used as a
table key — the AFK caches are keyed by GUID (afkStateCache[key] / afkStartTimes[key]),
so any unit whose GUID was secret crashed UpdateAFKIcon / ClearAFKCache with
"attempted to perform indexed assignment on a table that cannot be indexed with
secret keys".

GetAFKKey now returns the GUID only when it is accessible (canaccessvalue, checked
BEFORE any truthiness test on the GUID) and falls back to the unit token — a plain
string, never secret — otherwise. That keeps GUID-based keying (stable across token
reassignment) for normal units and a safe key for the rest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant