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 app crash when there is repeated SLEEP at the end of the "lines" slice #446

Merged

Conversation

alaingilbert
Copy link
Contributor

I found the issue while testing a low value of 5ms for sleepThreshold

The goal was to create the same delays as what I actually type.

Here is some related comments ->
https://news.ycombinator.com/item?id=39298134

Here is the stacktrace you would get without the fix:

panic: runtime error: index out of range [634] with length 634

goroutine 1 [running]:
main.inputToTape({0xc0004d8000?, 0xc00014c000?})
	/Users/username/Documents/vhs/record.go:153 +0x15d8
main.Record(0xc000118700?, {0x285e9e0?, 0x4?, 0x1c2156c?})
	/Users/username/Documents/vhs/record.go:117 +0x613
github.com/spf13/cobra.(*Command).execute(0x280c140, {0x285e9e0, 0x0, 0x0})
	/Users/username/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0x280ccc0)
	/Users/username/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/username/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/Users/username/go/pkg/mod/github.com/spf13/[email protected]/command.go:1032
main.main()
	/Users/username/Documents/vhs/main.go:250 +0xc9
exit status 2

…slice

I found the issue while testing a low value of 5ms for sleepThreshold
@alaingilbert alaingilbert force-pushed the fix_repeat_after_exit_crash branch from 3a3d98e to b694da0 Compare February 8, 2024 05:24
@maaslalani
Copy link
Contributor

Thank you so much!

@maaslalani
Copy link
Contributor

Awesome work again @alaingilbert, thank you!

@maaslalani maaslalani merged commit 9950678 into charmbracelet:main Mar 6, 2024
8 checks passed
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.

2 participants