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 escaped backslash crash #1870

Merged
merged 3 commits into from
Jan 25, 2023
Merged

Fix escaped backslash crash #1870

merged 3 commits into from
Jan 25, 2023

Conversation

jathak
Copy link
Member

@jathak jathak commented Jan 17, 2023

@@ -115,7 +115,8 @@ int? _lastNonWhitespace(String string, {bool excludeEscape = false}) {
if (excludeEscape &&
i != 0 &&
i != string.length &&
Copy link
Contributor

@connorskees connorskees Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can i ever be string.length? I think this condition should actually be checking against string.length - 1. That said, the fix in this PR does appear to solve the crash as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. That's actually a cleaner solution, so I'll change it to that. Thanks!

@jathak jathak requested a review from nex3 January 17, 2023 21:23
@jathak jathak merged commit 0006924 into main Jan 25, 2023
@jathak jathak deleted the backslash-crash-fix branch January 25, 2023 00:03
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 when selector ends with escaped backslash and no whitespace
3 participants