Skip to content

[shift-tab-crash] fix(core/config): prevent panic on Shift+Tab when projects is not a table - #195

Merged
zemaj merged 1 commit into
mainfrom
issue-194
Sep 18, 2025
Merged

[shift-tab-crash] fix(core/config): prevent panic on Shift+Tab when projects is not a table#195
zemaj merged 1 commit into
mainfrom
issue-194

Conversation

@just-every-code

Copy link
Copy Markdown

Fixes #194

Problem

  • Pressing Shift+Tab crashed the app with an unwrap panic at core/src/config.rs:827.
  • Root cause: when persisting per‑project access mode, the code assumed [projects] in config.toml was always a TOML table. If a user’s config had a conflicting scalar (e.g., projects = "…"), as_table_mut().unwrap() panicked.

Change

  • In set_project_access_mode:
    • Ensure projects exists and is a table; if the key exists with a non‑table type, replace it with a new table instead of unwrapping.
    • Ensure the per‑project entry exists and is a table; replace if it exists with the wrong type.
    • Return a descriptive error if, for any reason, the table cannot be prepared (no unwrap).

Why this is safe

  • Only affects config writing when toggling access mode (e.g., via Shift+Tab).
  • Preserves existing valid table contents; only replaces invalid shapes to avoid panics.
  • Keeps atomic write behavior and existing trust‑level harmonization logic.

Validation

  • Built locally with ./build-fast.sh (no warnings/errors).
  • Verified the panic site is now guarded against non‑table projects keys and invalid per‑project entries.

Notes

  • This is a minimal, targeted fix that addresses the reported crash without touching unrelated areas.

Auto-generated for issue #194 by a workflow.
Author: @github-actions[bot]

@github-actions

Copy link
Copy Markdown

@zemaj
zemaj merged commit 460b58d into main Sep 18, 2025
7 checks passed
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.

Shift+Tab=crashed

2 participants