Skip to content

fix: reject invalid volume values#10

Open
benrosiers wants to merge 1 commit into
remvze:mainfrom
benrosiers:fix-volume-validation
Open

fix: reject invalid volume values#10
benrosiers wants to merge 1 commit into
remvze:mainfrom
benrosiers:fix-volume-validation

Conversation

@benrosiers

Copy link
Copy Markdown

Summary

Reject invalid --volume values before starting playback.

Why

The README documents --volume as a value between 0 and 1, but the previous validation only checked numeric range comparisons. Non-numeric values such as banana become NaN, which does not fail < 0 or > 1 checks.

That could allow an invalid value to reach the playback layer and be passed to mpv.

Change

  • Parse the volume option once.
  • Reject empty, non-finite, below-range, and above-range values.
  • Reuse the parsed numeric value when starting playback.

Validation

  • npm run build
  • npm run lint

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