Skip to content
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

fix: prevent RangeError in updatePressure #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZebraVogel94349
Copy link

@ZebraVogel94349 ZebraVogel94349 commented Nov 25, 2024

The for loop in which updatePressure(i, pressure) is called is iterating over pts. When a stroke consists of only two points, additional points are added to pts, so pts has more points than points and updatePressure(), which updates points, is called for points that don't exist. This results in errors like Another exception was thrown: RangeError (length): Invalid value: Not in inclusive range 0..1: 4.
This commit fixes this behavior by changing the point that is updated in the for loop to the second point, if the stroke is consisting of exactly two points and i is larger than 1.
This fix is needed to fix saber-notes/saber#1391.

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.

Short pen strike shows up as an ink blob
1 participant