Skip to content

fix: guard against nil CFUUIDCreateString result in detectFullscreenDisplays#28

Merged
typester merged 1 commit into
mainfrom
fix/crash-when-display-disconnected
May 7, 2026
Merged

fix: guard against nil CFUUIDCreateString result in detectFullscreenDisplays#28
typester merged 1 commit into
mainfrom
fix/crash-when-display-disconnected

Conversation

@typester
Copy link
Copy Markdown
Owner

@typester typester commented May 7, 2026

CFUUIDCreateString returns CFString! (implicitly unwrapped optional) and can return nil when CGDisplayCreateUUIDFromDisplayID produces an invalid UUID during display state transitions (space switches, fullscreen app entry/exit).

The activeSpaceDidChange notification fires exactly at these transient moments, making it the trigger for the crash. Replace the implicit 'as CFString' force- unwrap with guard let so invalid displays are skipped instead of crashing.

…isplays

CFUUIDCreateString returns CFString! (implicitly unwrapped optional) and can
return nil when CGDisplayCreateUUIDFromDisplayID produces an invalid UUID during
display state transitions (space switches, fullscreen app entry/exit).

The activeSpaceDidChange notification fires exactly at these transient moments,
making it the trigger for the crash. Replace the implicit 'as CFString' force-
unwrap with guard let so invalid displays are skipped instead of crashing.
@typester typester merged commit 5e23e11 into main May 7, 2026
2 checks passed
@typester typester deleted the fix/crash-when-display-disconnected branch May 7, 2026 17:38
typester pushed a commit that referenced this pull request May 7, 2026
🤖 I have created a release *beep* *boop*
---


## [0.1.12](v0.1.11...v0.1.12)
(2026-05-07)


### Bug Fixes

* guard against nil CFUUIDCreateString result in
detectFullscreenDisplays
([#28](#28))
([5e23e11](5e23e11))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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