Skip to content

Prevent crash in GotoFirstNonBlankOfLine - #2051

Merged
Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
springcomp:#2050
Feb 10, 2021
Merged

Dongbo Wang (daxian-dbw) merged 1 commit into
PowerShell:masterfrom
springcomp:#2050

Conversation

@springcomp

@springcomp Maxime Labelle (springcomp) commented Dec 17, 2020 •

Copy link
Copy Markdown
Contributor

PR Summary

Fixes #2050.

The method GetBeginningOfLinePos is updated to remove call to LineIsMultiline that do not check the buffer input and attempts to access the underlying _buffer. Additionally, the method GetFirstNonBlankOfLogicalLinePos protects access to the _buffer member.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
Microsoft Reviewers: Open in CodeFlow

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with 1 comment.

Comment thread PSReadLine/Position.cs Resolved
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 9e09968 into PowerShell:master Feb 10, 2021
@ghost

Copy link
Copy Markdown

🎉 v2.2.0-beta2 has been released which incorporates this pull request. 🎉

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.

[vi-mode] GotoFirstNonBlankOfLine crashes PSRL when buffer is empty

2 participants