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: Unreachable code #2488

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix unreachable code
  • Loading branch information
Egor18 committed Sep 20, 2018
commit 634828bffca69969a59b7d5bfb4b76a545c75d4f
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ private int getEndOfComment(char[] content, int maxOff, int off) {
if (content[off] == '\r') {
//we have found end of this comment
//skip windows \n too if any
if (content[off] == '\n') {
if (off < maxOff && content[off + 1] == '\n') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it needs + 1. But also in first part of condition. Like this:
if (off + 1 < maxOff && content[off + 1] == '\n')
OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But why? The maximum value of maxOff is content.length - 1 (see the upper lines), so it seems like a valid bounds check to me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right! So it is OK. Thank you.

off++;
}
return off;
Expand Down