Skip to content

fix: hide file manager and terminal options for invalid repositories#2503

Merged
love-linger merged 1 commit into
sourcegit-scm:developfrom
JC-Chung:fix/open-invalid-repo-crash
Jul 1, 2026
Merged

fix: hide file manager and terminal options for invalid repositories#2503
love-linger merged 1 commit into
sourcegit-scm:developfrom
JC-Chung:fix/open-invalid-repo-crash

Conversation

@JC-Chung

@JC-Chung JC-Chung commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

When a repository folder has been deleted, two crash scenarios exist:

  1. On the Welcome page, right-clicking the invalid repository node
    (shown with an exclamation mark) and selecting "Open in File Manager"
    or "Open in Terminal" crashes with Win32Exception.

  2. Inside an open repository, if the folder is deleted while SourceGit
    is running, clicking the external tools button and selecting
    "Open in File Manager" or "Open in Terminal" also crashes.

Fix by:

  • Hiding "Explore" and "Terminal" menu items in the Welcome page context
    menu when node.IsInvalid is true, with an early return guard in
    RepositoryNode as a defensive safety net.
  • Adding a Directory.Exists check in RepositoryToolbar.OpenWithExternalTools
    before building the menu.

@love-linger love-linger self-assigned this Jul 1, 2026
@love-linger love-linger added the bug Something isn't working label Jul 1, 2026
@love-linger love-linger merged commit dd163e5 into sourcegit-scm:develop Jul 1, 2026
14 checks passed
@JC-Chung JC-Chung deleted the fix/open-invalid-repo-crash branch July 1, 2026 08:57
love-linger added a commit that referenced this pull request Jul 1, 2026
- Use `Directory.Exists(_id)` instead of `IsInvalid` since we have alread makes sure it's a repository
- For invalid repository node, only show `Delete` entry in context menu

Signed-off-by: leo <longshuang@msn.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants