Skip to content

fix: skip space-free lines in InputHelp.Parse to avoid IndexOf -1 crash - #780

Open
Bolt4243 wants to merge 1 commit into
mpvnet-player:mainfrom
Bolt4243:fix/inputconf-no-space-crash
Open

fix: skip space-free lines in InputHelp.Parse to avoid IndexOf -1 crash#780
Bolt4243 wants to merge 1 commit into
mpvnet-player:mainfrom
Bolt4243:fix/inputconf-no-space-crash

Conversation

@Bolt4243

Copy link
Copy Markdown

InputHelp.Parse called line[..line.IndexOf(" ")] without guarding against the -1 return value that IndexOf produces when no space is present. A space-free line in input.conf (bare key, garbage line, etc.) triggers an ArgumentOutOfRangeException and crashes the input editor.

Fix: capture the index first, and continue to the next line if it is negative. The rest of the parsing loop is unaffected.

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.

1 participant