Skip to content

fix: normalise steamuser config structure to prevent playlist creation crash#32

Merged
jagrat7 merged 2 commits intomainfrom
claude/issue-21-20260322-0057
Mar 22, 2026
Merged

fix: normalise steamuser config structure to prevent playlist creation crash#32
jagrat7 merged 2 commits intomainfrom
claude/issue-21-20260322-0057

Conversation

@jagrat7
Copy link
Copy Markdown
Owner

@jagrat7 jagrat7 commented Mar 22, 2026

Fixes "Cannot read properties of undefined (reading 'general')" when creating playlists on machines where the Wallpaper Engine config.json exists but lacks the steamuser.general keys.

Closes #21

Generated with Claude Code

github-actions bot and others added 2 commits March 22, 2026 00:59
Fixes 'Cannot read properties of undefined (reading general)' when
creating/updating/deleting playlists. readConfig() previously only fell
back to a default structure when JSON.parse threw, so a real Wallpaper
Engine config.json that exists on disk but lacks steamuser.general
(common on a fresh install where playlists were never used) would return
undefined for steamuser, crashing all mutation paths.

Now the parsed object is normalised with ??= so all callers can safely
assume the steamuser -> general -> playlists chain exists.

Fixes #21

Co-authored-by: Jagrat Rao <jagrat7@users.noreply.github.com>
…turning defaults

Previously all errors during config read were caught and defaulted to an empty structure. Now only missing file errors (ENOENT) return defaults; other errors like permission issues or malformed JSON are re-thrown so callers can handle them appropriately.
@jagrat7 jagrat7 merged commit 1992b8b into main Mar 22, 2026
@jagrat7 jagrat7 deleted the claude/issue-21-20260322-0057 branch March 22, 2026 02:14
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.

Playlist Creation Issues

1 participant