Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

fix: Return empty string from which_ide() when no IDE detected#172

Merged
gadenbuie merged 2 commits intomainfrom
fix/168-which-ide
Feb 27, 2026
Merged

fix: Return empty string from which_ide() when no IDE detected#172
gadenbuie merged 2 commits intomainfrom
fix/168-which-ide

Conversation

@gadenbuie
Copy link
Collaborator

Fixes #168

Summary

which_ide() implicitly returned NULL when no IDE environment variable matched (outside Positron, RStudio, or VS Code). In btw_app(), nzchar(NULL) produces logical(0), which crashes if() with "argument is of length zero".

The fix makes which_ide() return "" as its default, ensuring nzchar() always receives a scalar string. The now-redundant %||% "" guard in which_ide_title() is also removed.

Verification

# In a plain R session (no IDE):
btw::btw_app()
# Should launch without error

`which_ide()` implicitly returned NULL when no IDE environment variable
matched, causing `nzchar(NULL)` to produce `logical(0)` and crash
`if()` in `btw_app()`.

Fixes #168
@gadenbuie gadenbuie marked this pull request as ready for review February 27, 2026 14:50
@gadenbuie gadenbuie merged commit e2d2ac4 into main Feb 27, 2026
9 checks passed
@gadenbuie gadenbuie deleted the fix/168-which-ide branch February 27, 2026 15:43
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.

btw::btw_app(): An error has occurred! argument is of length zero

1 participant