Skip to content

Fix nil crash in Hammerspoon music display() - #339

Merged
drn merged 3 commits into
masterfrom
argus/resolve-2026-08-25
Aug 28, 2026
Merged

drn merged 3 commits into
masterfrom
argus/resolve-2026-08-25

Conversation

@drn

@drn drn commented Aug 28, 2026

Copy link
Copy Markdown
Owner

hs.itunes.getPosition()/hs.spotify.getPosition() can return nil when no playback position is available, crashing display() on arithmetic with nil. Extracts the percent-of-track math into a nil- and zero-total-safe lib.percentComplete, clamped to 0-100, with unit tests covering the nil/zero/rounding/out-of-range cases. Also documents a GOCACHE sandbox workaround for go install/test in the Pre-Completion Checklist.

Co-Authored-By: Claude noreply@anthropic.com

drn added 3 commits August 27, 2026 17:51
hs.itunes.getPosition()/hs.spotify.getPosition() can return nil when
no playback position is available, crashing display() on arithmetic
with nil. Extract the percent calculation into lib.percentComplete,
nil- and zero-total safe, and cover it with unit tests.
Review flagged that an unclamped percent (out-of-range current, or
negative input) could produce a nonsensical display value now that
percentComplete is a general-purpose lib function; clamp it and cover
the boundary with tests.
go install/test/vet hit the same sandboxed-write-permission class of
failure qlty already documents a HOME workaround for, but against
~/.argus/cache/go-build instead of ~/.qlty/logs. Capture the fix so
future sessions don't have to rediscover it.
@drn
drn merged commit d243144 into master Aug 28, 2026
@drn
drn deleted the argus/resolve-2026-08-25 branch August 29, 2026 09:03
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