-
Notifications
You must be signed in to change notification settings - Fork 18
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
Crash when first line is empty and -L is specified with a one character separator. #38
Comments
Something like this probably will fix it. diff --git a/src/lib/core.rs b/src/lib/core.rs
index dc45f43..476dfdc 100644
--- a/src/lib/core.rs
+++ b/src/lib/core.rs
@@ -520,7 +520,11 @@ where
line.push((start, index - 1));
start = index + 1;
} else if bytes[index] == newline {
- line.push((start, index - 1));
+ if (index != 0) {
+ line.push((start, index - 1));
+ } else {
+ line.push((0, 0));
+ }
let items = self.fields.iter().flat_map(|f| {
let slice = line
.get(f.low..=min(f.high, line.len().saturating_sub(1))) Although for performance reasons it might be better to check before the |
I closed it too soon. v0.6.5-alpha is adding an extra line when there is a blank line at the start. |
Okay, see v0.6.5 release which should be building now. |
@ghuls also, again, thanks for taking the time to make a detailed issue! You make these really easy to fix 👍 |
Thanks for the fast fix. |
Crash when first line is empty and -L is specified with a one character separator.
The text was updated successfully, but these errors were encountered: