ilai-deutel / kibi

A text editor in ≤1024 lines of code, written in Rust
Other
1.46k stars 83 forks source link

Fix crash when opening a new file #287

Open Jan9103 opened 8 months ago

Jan9103 commented 8 months ago

When opening a not existent file (example git checkout master; cargo run foo.txt) it will error out since the metadata check does not handle the case.

I'm not good at rust or too familiar with this project, but here's a working patch.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (8966c46) 48.70% compared to head (6359161) 48.51%.

Files Patch % Lines
src/editor.rs 0.00% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #287 +/- ## ========================================== - Coverage 48.70% 48.51% -0.19% ========================================== Files 11 11 Lines 1043 1047 +4 ========================================== Hits 508 508 - Misses 535 539 +4 ``` | [Flag](https://app.codecov.io/gh/ilai-deutel/kibi/pull/287/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel) | Coverage Δ | | |---|---|---| | [wasm32-wasi](https://app.codecov.io/gh/ilai-deutel/kibi/pull/287/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel) | `49.95% <0.00%> (-0.20%)` | :arrow_down: | | [x86_64-apple-darwin](https://app.codecov.io/gh/ilai-deutel/kibi/pull/287/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel) | `50.04% <0.00%> (-0.20%)` | :arrow_down: | | [x86_64-pc-windows-gnu](https://app.codecov.io/gh/ilai-deutel/kibi/pull/287/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel) | `0.20% <0.00%> (-0.01%)` | :arrow_down: | | [x86_64-unknown-linux-gnu](https://app.codecov.io/gh/ilai-deutel/kibi/pull/287/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel) | `49.95% <0.00%> (-0.20%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Ila%C3%AF+Deutel#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.