Skip to content

Fix NPE in PagedSeq.slice at end of seq #4758

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

Merged
merged 1 commit into from
Sep 21, 2015
Merged

Conversation

lrytz
Copy link
Member

@lrytz lrytz commented Sep 21, 2015

See scala/scala-parser-combinators#70

Basically the same thing as SI-6615, including the fact everything
works okay if the PagedSeq is printed before calling slice.

It might seem strange that this allows taking slices that start beyond
the end, but

  • this was possible anyway if one forced the entire sequence, and
  • it is reasonable to be able to take a slice at the very end (not
    beyond it) and get an empty sequence, which is exactly what
    StreamReader in scala-parser-combinators does and gets an NPE.

See scala/scala-parser-combinators#70

Basically the same thing as SI-6615, including the fact everything
works okay if the PagedSeq is printed before calling slice.

It might seem strange that this allows taking slices that start beyond
the end, but
 - this was possible anyway if one forced the entire sequence, and
 - it is reasonable to be able to take a slice at the very end (not
   beyond it) and get an empty sequence, which is exactly what
   StreamReader in scala-parser-combinators does and gets an NPE.
@lrytz
Copy link
Member Author

lrytz commented Sep 21, 2015

Already reviewed in #4753

SethTisue added a commit that referenced this pull request Sep 21, 2015
Fix NPE in PagedSeq.slice at end of seq
@SethTisue SethTisue merged commit 1986ed2 into scala:2.11.x Sep 21, 2015
@SethTisue SethTisue added this to the 2.11.8 milestone Sep 24, 2015
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.

3 participants