Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vim/#2349): Crash on :enew #2351

Merged
merged 4 commits into from Aug 24, 2020
Merged

fix(vim/#2349): Crash on :enew #2351

merged 4 commits into from Aug 24, 2020

Conversation

bryphe
Copy link
Member

@bryphe bryphe commented Aug 22, 2020

Issue: :enew would crash the editor

Defect: We were crashing when trying to infer the language type from the filename - in this code:

let fileName = Path.filename(fp);

The Rench.Path.filename (which uses Fpath under the hood) - is not robust against an empty filename.

Fix: Don't crash in that case - if it's an empty file name, just use the default ("plaintext") filetype. Add a regression test so we can ensure this doesn't break again in the future.

Longer term, I'd like to look at moving towards a strongly-typed solution for file path / name management - would like to integrate: https://github.com/facebookexperimental/reason-native/tree/master/src/fp

Fixes #2349

@bryphe bryphe merged commit d2a5979 into master Aug 24, 2020
2 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.

crash on :enew
1 participant