Skip to content

Conversation

@JakeWharton
Copy link
Contributor

Closes #361

Comment on lines +721 to +723
if (this.head == null) {
return lambda(null, -1L)
}
Copy link
Contributor Author

@JakeWharton JakeWharton Aug 2, 2024

Choose a reason for hiding this comment

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

This seems like it was a bug. Prior to this, the lambda would be called twice. Once with (null, -1) and then again in the if with (null, 0). Contract validation failed without changing the implementation to early-return here, as I expect was intended.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was a bug, indeed. Thanks for catching and fixing it!

@fzhinkin fzhinkin self-requested a review August 12, 2024 17:28
@fzhinkin fzhinkin self-requested a review August 15, 2024 13:29
Copy link
Collaborator

@fzhinkin fzhinkin left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix, @JakeWharton!

@fzhinkin fzhinkin merged commit ecd60a8 into Kotlin:develop Aug 15, 2024
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.

2 participants