Skip to content

fix(settings): don't crash the recognition page with no translation engines - #126

Merged
bitdan merged 1 commit into
masterfrom
fix/recognition-empty-engines
Nov 28, 2026
Merged

bitdan merged 1 commit into
masterfrom
fix/recognition-empty-engines

Conversation

@bitdan

@bitdan bitdan commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • On macOS there is no local translation, so after deleting the last translation service the translation engine list is empty. The dropdown still asks for the icon of item 0, and engines_tr[index] panicked (index out of bounds: the len is 0 but the index is 0, settings_recognition.rs:478) as soon as the 识别与翻译 page opened, closing the app.
  • Both engine dropdown icon lookups (OCR and translation) now use get() and draw no icon when the list is empty.

Test plan

  • cargo check -p snap-desk-gpui (no warnings)
  • cargo test -p snap-desk-gpui
  • Manual on macOS: delete every translation service, open 识别与翻译

🤖 Generated with Claude Code

…ngines

On macOS there is no local translation, so after deleting the last
translation service the engine list was empty and the dropdown icon
lookup indexed item 0, panicking as soon as the page opened. Both
engine dropdowns now look items up with get().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bitdan
bitdan merged commit 0431b48 into master Nov 28, 2026
3 checks passed
@bitdan
bitdan deleted the fix/recognition-empty-engines branch November 28, 2026 10:26
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