Skip to content

Fix app crash when there is repeated SLEEP at the end of the "lines" slice - #446

Merged
maaslalani merged 1 commit into
charmbracelet:mainfrom
alaingilbert:fix_repeat_after_exit_crash
Mar 6, 2024
Merged

maaslalani merged 1 commit into
charmbracelet:mainfrom
alaingilbert:fix_repeat_after_exit_crash

Conversation

@alaingilbert

Copy link
Copy Markdown
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/cobra@v1.8.0/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0x280ccc0)
	/Users/username/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/username/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/Users/username/go/pkg/mod/github.com/spf13/cobra@v1.8.0/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
Copy Markdown
Contributor

Thank you so much!

@maaslalani

Copy link
Copy Markdown
Contributor

Awesome work again @alaingilbert, thank you!

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

⌂ 换网址